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
Hello
I am trying to work out the cumulative amounts for each month using the following dax queries with Rankx.
Month Numbers =
SWITCH([Total Sales Ranking by Month],
"JAN", 1,
"FEB", 2,
"MAR", 3,
"APR", 4,
"MAY", 5,
"JUN", 6,
"JUL", 7,
"AUG", 8,
"SEP", 9,
"OCT", 10,
"NOV", 11,
"DEC", 12,0)
Cumulative Sales by Month Number =
var monthNos = [Month Numbers]
RETURN
SUMX(
FILTER(
SUMMARIZE(
'Calendar', 'Calendar'[Month],
"Sales", [Total Sales],
"Sales Ranking", RANKX(ALL('Calendar'[Month]), [Total Sales], , ASC)
),
[Sales Ranking] >= monthNos
),
[Sales]
)
But I end up with the same values in both the Total Sales and Cumulative columns. What am I doing wrong?
Thanks
Yoshi
If you're looking to do cumulative sum based on column that is not date, you may find this helpful: https://community.powerbi.com/t5/Desktop/Cumulative-SUM-using-Rank-NOT-Dates/m-p/170623
@Yoshimitsu411 , As you have date and you want a yearly total then you can use datesytd
example
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
For Cumulative with help from date table
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 35 | |
| 33 | |
| 32 | |
| 27 |
| User | Count |
|---|---|
| 136 | |
| 96 | |
| 77 | |
| 67 | |
| 65 |