Forum Discussion
DAX to find Previous Period
- 5 years ago
msommerf , Make sure you have a separate period table(Say Date), Then create a rank column on period
Period Rank = RANKX(all('Period'),'Period'[year period],,ASC,Dense) //YY-MM format column in your case
Then create measure like
example
This Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])))
Last Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])-1))Last year Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Period] = Max('Date'[Period])))
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
you can create a column in the datetime table. please see the attachment below.
period&year =
VAR _date=DATEADD('Table'[Date],-1,MONTH)
return if(ISBLANK(_date),blank(),maxx(FILTER('Table','Table'[Date]=_date),'Table'[Fiscalyear])&"-"&maxx(FILTER('Table','Table'[Date]=_date),'Table'[Period]))
- msommerf5 years ago
Helper III
Many thanks for responding. I have applied your suggestion but the results are not as expected. My periods do not align to any months: