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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
janainacarmo
Regular Visitor

Cumulate quantity

Hello Guys!

 

Please, see if you guys can help me with this question.
I have to calculate the accumulate year to year of quantity, as example below:

 

A car has to have his oil changed every year, so, if I have 10 cars having  their oil changed in 2017 and 20 cars having their oil changed in 2018, the index has to calculate:

2017: 10

2018: 20 + 10 (from 2017, because the same 10 cars in 2017, has to have the oil changed again in 2018)

Total: 40 cars   

 

I created the following index that is working partially, it means that is calculating right, but if I change the period to see the data just in 2018, the index continue calculating from 2017, so it's is showing 40 quantity rather than 20 .

 

measure = CALCULATE (
SUMX(TIV;[Valor]);
FILTER(
ALLEXCEPT(TIV;TIV[Linha];TIV[Segmento]);
'TIV'[year] <= MAX ( 'TIV'[year])); ALLEXCEPT(TIV;TIV[Linha];TIV[Segmento]);TIV[Brand]="Other"
)
 
Waiting for your support guys, thank you!
Janaina
4 REPLIES 4
v-yuta-msft
Community Support
Community Support

@janainacarmo ,

 

You may modify your measure using dax below:

measure =
CALCULATE (
    SUMX ( TIV; [Valor] );
    FILTER (
        ALLEXCEPT ( TIV; TIV[Linha]; TIV[Segmento] );
        TIV[Brand] = "Other"
            && 'TIV'[year] IN VALUES ( 'TIV'[year] )
    )
)

Community Support Team _ Jimmy Tao

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

Dear @v-yuta-msft ,

 

Thank you for your reply, but this index is not working as cummulative...it is just counting the value year per year.

 

Thank you for your supporting until now.

 

Best Regards, Janaina

Nathaniel_C
Community Champion
Community Champion

Hi @janainacarmo ,

 

This cumulative count works in dashboard and works with a time slicer and a program slicer.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

Cumulative Count of Customers = 

VAR MaxDate = MAX ( aver[Date] )-- Saves the last visible date
var Counter =
    CALCULATE (
        [Count of customers],            -- Computes customers
        aver[Date]<= MaxDate,   -- Where date is before the last visible date
        ALLEXCEPT( aver,aver[Program] )              -- Removes any other filters from Date allexcept aver([Program]

   )
return Counter




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Dear @Nathaniel_C ,

 

Thank you for your reply, but it still not working properly...the cumulative is working fine, but when I change the períod for 2017-2019, it still being summing the value from 2016. The total from the first year, in the period that I chose in the time slicer, should not be cumulative. I attached two prints (períod 2016-2019 and 2017-2019) and highlighted them in yellow as you can see.

 

https://drive.google.com/drive/folders/1TBOsDKqiGUfnsGZugNfcZfF4-OiDCtYm?usp=sharing

 

Thank you for your support until now.

Best Regards, Janaina

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.