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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors