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
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
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.

Top Solution Authors