cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

Running total of measure

Hi all

I have been googling and reading posts a lot, but I still can't find a solution.

The root of my problem is probably the way the running total is calculated, but I can't find the reason.

YearMonthDayLJ_MAX_SUMRT_LJ_MAX_SUMWhat I want
2020January1917917917
2020January290717311824

 

The data of the last 5 years:

YearMonthDaySum per day
2016January1543
2016January2664
2017January1515
2017January2585
2018January1712
2018January2907
2019January1917
2019January2814
2020January11104
2020January21180

 

 

LJ_MAX_SUM= 
VAR Temp=
UNION(
ROW("test2", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-1,YEAR))),
ROW("test3", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-2,YEAR))),
ROW("test4", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-3,YEAR))),
ROW("test5", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-4,YEAR))),
ROW("test6", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-5,YEAR))),
ROW("test7", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-6,YEAR))),
ROW("test8", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-7,YEAR))),
ROW("test9", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-8,YEAR))),
ROW("test10", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-9,YEAR))),
ROW("test11", CALCULATE(SUM(data[Value]),DATEADD('Calendar_future'[Date],-10,YEAR)))
)
RETURN
MAXX(Temp, [test2])/1000

 

 

 

RT_LJ_SUM_MAX = CALCULATE (
   [LJ_MAX_SUM],
    FILTER (
        ALLSELECTED(  'Calendar_future'),
        'Calendar_future'[Date] <= MAX ( 'Calendar_future'[Date] )
    )
)

 

 

The measure ''RT_LJ_SUM_MAX' takes the green and blue marked value and calculates the running total. What I want is, that it takes the green and red value to calculate the running total.

How can I do this?

Really appreciate your help.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hello @adrianrupp ,

Try this:

RT_LJ_SUM_MAX =
SUMX (
    FILTER (
        ALLSELECTED ( 'Calendar_future' ),
        'Calendar_future'[Date] <= MAX ( 'Calendar_future'[Date] )
    ),
    [LJ_MAX_SUM]
)

Or this:

RT_LJ_SUM_MAX =
SUMX (
    FILTER (
        ALLSELECTED ( 'Calendar_future' ),
        'Calendar_future'[Date] <= MAX ( 'Calendar_future'[Date] )
            && Calendar_future[Date]. [Year] = MAX ( Calendar_future[Date].[ Year] )
    ),
    [LJ_MAX_SUM]
)

Best regards

Icey

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hello @adrianrupp ,

Try this:

RT_LJ_SUM_MAX =
SUMX (
    FILTER (
        ALLSELECTED ( 'Calendar_future' ),
        'Calendar_future'[Date] <= MAX ( 'Calendar_future'[Date] )
    ),
    [LJ_MAX_SUM]
)

Or this:

RT_LJ_SUM_MAX =
SUMX (
    FILTER (
        ALLSELECTED ( 'Calendar_future' ),
        'Calendar_future'[Date] <= MAX ( 'Calendar_future'[Date] )
            && Calendar_future[Date]. [Year] = MAX ( Calendar_future[Date].[ Year] )
    ),
    [LJ_MAX_SUM]
)

Best regards

Icey

If this post helps,then consider Accepting it as the solution to help other members find it faster.

Anonymous
Not applicable

Hi @Icey 

Thank you for the reply!

Both solutions work!

Best regards,

Adrian

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors