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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
RMDNA
Solution Sage
Solution Sage

Rank for running total - measure vs. column

Hi all,

 

Note: I'm working on a PBIX to share, but the amount of data to simulate, even for a subset, will take me a while.

 

I'm trying to create a rank of products by sales volume for my product table, which will eventually be used for a running total. From what I understand, the rank needs to be a column to be used in the running total formula. When I was only using slicers from the products table, I could create the rank as a column, and it worked just fine.

 

 

Rank = rankx(all('Product Sales'), 'Product Sales'[% of Total])

Running Total = 
CALCULATE (
    SUM ('Product Sales'[% of Total]),
    FILTER (
        ALL ('Product Sales'),
		'Product Sales'[Rank] <= EARLIER ('Product Sales'[Rank])
    ))

However, when I attempt to filter by fields outside of the home table, Rank as a column returns all values as 1. I can get it to work as a measure, but then it can't be used as a running total.

 

a.PNG

 

I feel like I'm missing something simple here.

1 ACCEPTED SOLUTION

Hi,

 

You may refer to my solution in this file.  I have not used any calculated column - only meaures.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

Share a dataset and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur,

 

.PBIX is attached.

 

I have a visual on the first tab which is working properly - products are arranged in decreasing order by sales volume and rank (and by association, increasing running total). It properly responds to the slicer on the page.

 

The second tab contains a table with the same data, but I can't get the rank to work as a column (in order to work in the running total formula) and still respond to the slicer. @Greg_Deckler recommended "a temp table using something like SUMMARIZE or GROUPBY," but I'm not sure exactly what he means, or how to accomplish it.

Hi,

 

You may refer to my solution in this file.  I have not used any calculated column - only meaures.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

Why can't you use it as a running total? Just create a temp table using something like SUMMARIZE or GROUPBY or FILTER or whatever. Can't be more specific without sample/example data.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler,

 

I don't know enough to do what you're suggesting. PM'd you data.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors