We want to know the number of profitable days achieved each month of the year. The data in Sample Superstore is recorded at the transactional level.
Create a Date Table
There's no way around it, the best way to ensure PowerBI handles dates correctly when using DAX date functions is to create a date table in PowerQuery. Auto Date/time will create one automatically, but it's better to do it manually and avoid unpredictable problems (like the first time I tried to build this chart). We're not going to use it in the building of the chart, but relate it to the Orders table in the data model.
Calculate the daily profit
Create a new measure.
Daily Profit =CALCULATE (
SUM ( 'Orders'[Profit] ),
ALLEXCEPT ( 'Orders', 'Orders'[Order Date] )
)
Create a column to classify each day as Highly Profitable, Profitable or Unprofitable
Level of profitability =IF (
Orders[Daily Profit] < 0,
"Unprofitable",
IF ( Orders[Daily profit M] > 200, "Highly Profitable", "Profitable" )
)
Assemble the chart
Select "Area Chart" in the visualization tab (with Count Distinct of Order Date in the Y-axis), drag in the fields and the KPI chart is done!
Except PowerBI doesn't allow dragging a the Level of profitability field into the legend when it's already in the small multiples. Creating a copy of the field and using that instead gets rid of the problem.

