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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Cumulative totals

Hi, I want to calculate the cumulative values for vol and NNS columns in the screenshot. But also taking into account of the dummy column so rows that have "a" should proceed as 5-10-15 and the ones with "b" should proceed as 6-12-18 for YTD Vol column as an example. Right now my formula doesn't take the Dummy column into account and adds both a and b values for YTD. I would really appreciate If you can help me with a general solution as the screenshot is just me testing this and the real data will have multiple dummy columns and way more than 2 different values in each column.

cumul question.png

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

This should work:

YTD = 
VAR __CurrentDate= Table1[Date]
Var __CurrentDummy = Table1[Dummy]
Var __CurrentYear = YEAR(Table1[Date])

Return
CALCULATE(
    SUM( Table1[vol]),
    FILTER(
        ALL( Table1),
        __CurrentDate >= Table1[Date]
        && __CurrentDummy =  Table1[Dummy]
        && __CurrentYear = YEAR(Table1[Date])
    )
)

Earlier in Calc Column.png

View solution in original post

Anonymous
Not applicable

Ok I managed to work it, although I just have a single year in my data set so I didnt need to include anything else for other years basically.


cumul question.png


pbis.png

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Ok I managed to work it, although I just have a single year in my data set so I didnt need to include anything else for other years basically.


cumul question.png


pbis.png

Anonymous
Not applicable

This should work:

YTD = 
VAR __CurrentDate= Table1[Date]
Var __CurrentDummy = Table1[Dummy]
Var __CurrentYear = YEAR(Table1[Date])

Return
CALCULATE(
    SUM( Table1[vol]),
    FILTER(
        ALL( Table1),
        __CurrentDate >= Table1[Date]
        && __CurrentDummy =  Table1[Dummy]
        && __CurrentYear = YEAR(Table1[Date])
    )
)

Earlier in Calc Column.png

Anonymous
Not applicable

Thanks for your answer,

I tried it many different ways but I cant have it work for some reason, Im new to DAX and I cant figure which variable's format I should be changing.

 

pbiq.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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