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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
polanddm
Regular Visitor

Constrained Running Total

Hi all, my first post/question! 

 

New to Power BI, enjoying learning.

 

I have a single table data model that has columns like this:

 

Stuf...Type....Value...Data...Stuff

 

For each "Type", I have a serveral Value and Date pairs associated.

 

What I would like to be able to do is create a "CumulativeValue" measure so that I can chart this information in a Line Chart (where each "Type" is a Legend entry).

 

I have seen DAX like this:

 
CumulativeX = CALCULATE(Table[X],filter(all(Table[Date]), Table[Date] <= max(Table[Date])))
 
However, this is not precisely what I am after as the *date range* for each distinct Type of data is different.
 
What I would like to be able to do is accumulate a running total for a Value that honors the max Date for each Type.
 

I would really appreciate any suggestions or pointers on how to do this!

 

Thanks,

 

Doug

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @polanddm 

 

Try something like this

CumulativeX =
CALCULATE (
    [X],
    FILTER ( 
        ALLEXCEPT( Table, Table[Type] ), 
        Table[Date] <= MAX ( Table[Date] ) 
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @polanddm 

 

Try something like this

CumulativeX =
CALCULATE (
    [X],
    FILTER ( 
        ALLEXCEPT( Table, Table[Type] ), 
        Table[Date] <= MAX ( Table[Date] ) 
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Many thanks Mariusz!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors