Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I have a table that is by Contract, Period (YYYYMM). I have a measure that is grabbing the previous record based on the Period column. This works great when the previous record is in the same year, but when I go from 202101 to 202012, my measure will not work. I am looking for some guidance on the best approach to grab previous record when it switches years based on my Period column.
Solved! Go to Solution.
@mkoontz , Create a rank on YYYYMM in you date table.
a new column
Period Rank = RANKX(all('Date'),'Period'[year period],,ASC,Dense)
try measures like these examples
This Period = CALCULATE( [measure for column ($)], FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])))
Last Period = CALCULATE( [measure for column ($)], FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])-1))
@mkoontz , Create a rank on YYYYMM in you date table.
a new column
Period Rank = RANKX(all('Date'),'Period'[year period],,ASC,Dense)
try measures like these examples
This Period = CALCULATE( [measure for column ($)], FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])))
Last Period = CALCULATE( [measure for column ($)], FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])-1))
@amitchandak Thank you for the quick reply. Greatly appreciated. Your solution worked great for me.
Thank you again.
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
118 | |
101 | |
71 | |
61 |