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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
wmcintosh
Frequent Visitor

DAX measure to calculate Descending running total of scores by Date

I have a table of Risks, each with a Pre and Post-action score.

table 1.png

 

I need to chart the reduction in Risk score by Completion date. Based on the above this would give me the following:

table 2.png

 


... which I could then represent as:

chart.png


Seems simple enough but how do I get the 'Total minus Risk Score by completion date' as a measure?
I have tried the following:

Pre Mitigation Risk Score minus Risk Score Delta running total in Date =
CALCULATE(
SUM('Risks (Project)'[Pre Mitigation Risk Score]) - [Risk Score Delta],
    FILTER(
        ALLSELECTED('Calendar'[Date]),
        ISONORAFTER('Calendar'[Date], MIN('Calendar'[Date]), ASC)
    )
)

 

My Risks table and Calendar table are joined by Completion Date.

Grateful for any assistance.

 

1 ACCEPTED SOLUTION

Hi @TheoC 

That didn't work however I managed to get there with:

CALCULATE(
SUM('Risks (Project)'[Pre Mitigation Risk Score]),
FILTER(
ALLSELECTED('Calendar'[Date]),
ISONORAFTER('Calendar'[Date], MAX('Calendar'[Date]), ASC)
)
)

I was almost there originally - I think the issue was that some Action Completion Dates exceeded the range of my Date dimension table. Once I fixed that I got the desired visualisation.

Power BI_RR.png


Appreciate your responses throughout.

Thanks,
Wayne

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @wmcintosh ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please feel free to let me know.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

@TheoC , @Anonymous 
Apologies for the delay and thanks for all responses, however I never did manage to solve my problem. 
I've provided some sample data below. 
I have measures for Actual RS in Month 1 ([Baseline]) and the delta for each subsequent month [MonthRR].
What I need is a measure for [Actual RS] for each subsequent month, the formula for which should be:
Actual RS for the previous month minus Month RR for the current month.

Any assistance greatly appreciated.

DateJan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Nov-22Dec-22Jan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24Feb-24Mar-24Apr-24May-24Jun-24 
Actual RS         30,166        30,151        30,135        30,088        29,995        29,928        29,074        28,817        28,414        27,853        27,586        27,147        26,904        26,567        26,476        26,270        26,087        25,609        25,538        25,430        25,294        25,168        25,128        25,045        24,981        24,975        24,824        24,580        24,543 
Month RR                  -                  15                16                47                93                67              854              257              403              206              267              439              243              337                91              206              183              478                71              108              136              126                40                83                64                  6              151              244                37 
TheoC
Super User
Super User

Hi @wmcintosh 

 

Are you wanting a measure to calculate the change or is this already calculated in your data source?  

 

If you already have the calculation, then just drag the Date on the X Axis of a chart, and the column with the Total Risk Score Minus column onto the Y Axis.

 

Alternatively, try the following:

 

Descending Running Total = 

CALCULATE (
    SUMX (
        'Risks (Project)' ,
        'Risks (Project)'[Pre Mitigation Risk Score] - 'Risks (Project)'[Risk Score Delta]
    ) ,
    FILTER (
        ALLSELECTED ( 'Calendar'[Date] ) ,
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    ) ,
    ORDERBY ( 'Calendar'[Date] , DESC )
)

 

Thanks,

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@TheoC  Thanks for your reply. I do have a mesure that calculates the change ([Risk Score Delta]) however I need to be able to chart how each action reduces the overall risk score by the delta (starting from the sum of the pre-action scores) by action completion date. 

I tried the measure you suggested but this gave the error 'The ORDERBY function can only be used in the OrderBy parameter of windows functions'.

Hi @wmcintosh 

 

Can you give the below a try (and apologies for the earlier error).

 

Descending Running Total = 

CALCULATE (
    SUMX (
        'Risks (Project)' ,
        'Risks (Project)'[Pre Mitigation Risk Score] - 'Risks (Project)'[Risk Score Delta]
    ) ,
    FILTER (
        ALLSELECTED ( 'Calendar'[Date] ) ,
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
)

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi @wmcintosh 

 

Can you please try this measure that I put forward:


Descending Running Total = 

CALCULATE (
    SUMX (
        'Risks (Project)' ,
        'Risks (Project)'[Pre Mitigation Risk Score] - 'Risks (Project)'[Risk Score Delta]
    ) ,
    FILTER (
        ALLSELECTED ( 'Calendar'[Date] ) ,
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
)

 

Thanks heaps. 

 

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi @TheoC 

That didn't work however I managed to get there with:

CALCULATE(
SUM('Risks (Project)'[Pre Mitigation Risk Score]),
FILTER(
ALLSELECTED('Calendar'[Date]),
ISONORAFTER('Calendar'[Date], MAX('Calendar'[Date]), ASC)
)
)

I was almost there originally - I think the issue was that some Action Completion Dates exceeded the range of my Date dimension table. Once I fixed that I got the desired visualisation.

Power BI_RR.png


Appreciate your responses throughout.

Thanks,
Wayne

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.