Forum Discussion
Previous Month
Hi Team,
I have the following measure to get year month (YYYYMM) number for the value selected in the date filter.
Hi Jos13 ,
We can try to use the following measure to meet your requirement:
Prev Year Month = VAR CYM = MIN ( 'Date'[YM no] ) RETURN CALCULATE ( MAX ( 'Date'[YM no] ), FILTER ( ALL ( 'Date' ), 'Date'[YM no] < CYM ) )
Best regards,
4 Replies
- v-lid-msftCommunity Support
Hi Jos13 ,
We can try to use the following measure to meet your requirement:
Prev Year Month = VAR CYM = MIN ( 'Date'[YM no] ) RETURN CALCULATE ( MAX ( 'Date'[YM no] ), FILTER ( ALL ( 'Date' ), 'Date'[YM no] < CYM ) )
Best regards, - amitchandakSuper User
With date calendar and rime intelligence, you can get that easily. Make sure you move all your month year calc to the calendar table
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date])) last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH))) last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH)))) last year MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH)))) last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))Appreciate your Kudos.
- amitchandakSuper User
Jos13 has the above replies helped. if you need more help make me @
Appreciate your Kudos.
- Greg_DecklerCommunity Champion
If time intelligence functions fail you, See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008