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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
bcohen
Frequent Visitor

Dynamic Cumulative Totals on Pivoted Table

I have a table with pivoted data as shown below.

 

bcohen_0-1689104728593.png

 

I want to create a display a cumulative staff totals by year, for either of the Attributes selected on a Slicer object (education level or gender).  How do I design a solution (a cumulative total) that re-calculates cumulative totals based on user selections in a Slicer?

 

So far, I've used a standard cumulative total calculation, but it does not provide accurate results:

bcohen_1-1689104961264.png

 

CumulativeStaffTotal = CALCULATE( SUM(Merge1[netchange]), FILTER(ALLSELECTED(Merge1), Merge1[Value]=EARLIER(Merge1[Value]) && Merge1[year]=EARLIER(Merge1[year]) ))

 

 

What approach would you use to solve this problem?

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi ,  @bcohen 

According to your description, Do you want to calculate the cumulative value of the year based on the year? For example, 1973=1971+1972.

If this , you can just try to use this dax code:

Measure = CALCULATE( SUM('Merge1'[netchange]) ,'Merge1'[year]<= MAX('Merge1'[year]))

 

The result as follows:

 vyueyunzhmsft_0-1689218286019.png

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

View solution in original post

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi ,  @bcohen 

According to your description, Do you want to calculate the cumulative value of the year based on the year? For example, 1973=1971+1972.

If this , you can just try to use this dax code:

Measure = CALCULATE( SUM('Merge1'[netchange]) ,'Merge1'[year]<= MAX('Merge1'[year]))

 

The result as follows:

 vyueyunzhmsft_0-1689218286019.png

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.