Forum Discussion
legrand
Helper I
8 years agoPrevious Month without filter
Hi, I want to calculate the invoice count or average order value of the previous month. I got this working with either DATEADD() or PREVIOUSMONTH() but only when filtering my Power BI sheet to the c...
- 8 years ago
WolfBiber
Microsoft Employee
8 years agoHey,
easiest way is just to add another measure:
CountPreviousMonthFromToday = CALCULATE([CountPreviousMonth];DateTable[Date]= Today())
The reason is that Powerbi doesnt know for a single value what is the last passed month. Your Measure
CountPreviousMonth = CALCULATE(COUNT(Invoices[InvNr]);PREVIOUSMONTH(DateTable[Date].[Date]))
returns a table.
For correct function of measure
CountPreviousMonthFromToday
you have to extend your date table to minimun until today.
Hope it helps.
Greetings.
WolfBiber
Microsoft Employee
8 years agoCountPreviousMonth = CALCULATE(COUNT(Invoices[InvNr]);PREVIOUSMONTH(DateTable[Date]))
sorry, there was a 'Date' to much :D
find correct formula above
- legrand8 years ago
Helper I
Hi,
now it shows me the table as a result but the final measure is still blank :smileysad:
Many thanks!