Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Yoshimitsu411
Resolver I
Resolver I

DAX Month Cummulative using SUMX RANKX

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? 

 

TotalYTD Incorrect4.PNG

 

Thanks

Yoshi

2 REPLIES 2
YukiK
Impactful Individual
Impactful Individual

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

amitchandak
Super User
Super User

@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])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.