Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi
I have only recently realsied that this is a problem but am now struggling to find a solution. I have a measure that counts records in the latest month minus 1. This appeared to be working fine with the DAX below but I have relaised that if you put this into a table broken down by person (for example) it will give you the latest month minus 1 for each individual. I need it to be the latest month minus 1 for the entire data set but whatever I add seems to break the measure.
Solved! Go to Solution.
@Topjacket , You need have table with Month year(Say Date) and Rank, join back with you table on year month
Then you can have column in that table
Month Rank = RANKX(all('Date'),'Date'[year month ],,ASC,Dense)
and have measures like
This Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])))
Last Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])-1))
or
latest -1
Last Month =
var _max = maxx(allselected('Date') ,'Date'[Month Rank])
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=_max -1))
Thanks amitchandak
Really appreciate the quick reply.
@Topjacket , You need have table with Month year(Say Date) and Rank, join back with you table on year month
Then you can have column in that table
Month Rank = RANKX(all('Date'),'Date'[year month ],,ASC,Dense)
and have measures like
This Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])))
Last Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])-1))
or
latest -1
Last Month =
var _max = maxx(allselected('Date') ,'Date'[Month Rank])
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=_max -1))
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 13 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 25 | |
| 10 | |
| 10 | |
| 6 | |
| 6 |