Forum Discussion
Get Previous row record dynamically
- 5 years ago
Anonymous , I am assuming table two unique year month table.
Create a new column in both tables
Date = "01-" & [Month] & "-" & [year] // Change data type to date.
Join both 1-M from Table 2 to table
Create a new column in table 2
Month Year sort = FORMAT([Date],"yyyymm")
Month Rank = RANKX(ALL('Table2'),'Table2'[Month Year Sort],,DESC,Dense)Try measure like these example
This Month = CALCULATE(count('Table1'[Student- ID]), FILTER(ALL('Table2'),'Table2'[Month Rank]=max('Table2'[Month Rank])))
Last Month = CALCULATE(count('Table1'[Student- ID]), FILTER(ALL('Table2'),'Table2'[Month Rank]=max('Table2'[Month Rank])-1))
Thanks amitchandak this is what I am doing since two days but I made small mistake in my previous calculation, which throws error
But now everything works perfectly
Thanks!