Forum

DAX help - Running ...
 
Notifications
Clear all

[Solved] DAX help - Running Total and filters

5 Posts
3 Users
0 Reactions
317 Views
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

Dear All,

I'm in dire need of DAX help in PowerBI, please. 

I have a history of policy transactions. I need to take Running Total Premium for all transactions and divide it by Limit, but only for the latest transaction for each policy.

I'm attaching an Excel file with my mock-up data and measures and adding a screenshot (if it works for me). I'm pretty sure the issue is with my Running Total premium and its filters. The Running Total itself works in Power BI, just not for my purpose. (Incidentally, it throws an error in Excel's Power Pivot and won't work at all).

Screenshot-DAX-RT-help.png

Thank you,

Blanka

 
Posted : 19/12/2024 2:21 pm
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

See if the attached solution tackles your problem. Not sure I fully understand your case though.

I added a calculated column that functions like a SUMIF on each row based on the Policy. The running total measure sums that column but only for the rows where the 'latest transaction' = Yes.

 
Posted : 20/12/2024 6:13 am
(@debaser)
Posts: 836
Member Moderator
 

You could add a couple of calculated columns:

LatestLimit: =if(MyTable[LatestTransaction]="Yes",MyTable[Limit],BLANK())

LatestLimitBand: =LOOKUPVALUE([LimitBand],MyTable[LatestTransaction],"Yes",MyTable[Policy],MyTable[Policy])

 

then use LatestLimitBand as the row field, LatestLimit to get the total limit, and just sum the original AnnualizedPremium.

 
Posted : 20/12/2024 7:16 am
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

So, the secret lies in calculated column(s) and not in a measure. I did not even think about it and was not familiar with some of these formulas. 

I can work with any of these solutions now. I will see how they affect the size of my file once I incorporate them and will pick one.

Thank you both, Riny and Velouria! I wanted to mark both your answers as "Answers Post", but it will not let me do that. I appreciate you both.

 
Posted : 20/12/2024 11:07 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

Glad you worked it out either way!

 
Posted : 20/12/2024 11:41 am
Share: