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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
stefan2297
Frequent Visitor

Calculating Sum of previous dates till the one i selected on the graph

Hello everyone,

 

I have the next graph and i want to have on the cumul wasted time and cumulative claimed hours the sum of previous values.
power bi.jpg

 

for example: for the blue line i want to have 12 as value, not 5. 

 

Any ideas how i can do that? I try with some filters and things but don't work.

 

Thank you in advance for help.

 

Br,

S.

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

Hi @stefan2297 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1681353927923.png

(2) We can create a measure. 

Measure = SWITCH(TRUE(),
MAX('Table'[type]) in {"cumul wasted time per detection date","cumulative claimed hours"},CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),'Table'[type]=MAX('Table'[type]) && 'Table'[date]<=MAX('Table'[date]))),
MAX('Table'[type])="running balance",MAX('Table'[value]))

(3) Then the result is as follows.

vtangjiemsft_1-1681354006492.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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-tangjie-msft
Community Support
Community Support

Hi @stefan2297 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1681353927923.png

(2) We can create a measure. 

Measure = SWITCH(TRUE(),
MAX('Table'[type]) in {"cumul wasted time per detection date","cumulative claimed hours"},CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),'Table'[type]=MAX('Table'[type]) && 'Table'[date]<=MAX('Table'[date]))),
MAX('Table'[type])="running balance",MAX('Table'[value]))

(3) Then the result is as follows.

vtangjiemsft_1-1681354006492.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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