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.
Hello,
Please see my data via this link:
and my short video to explain what the issue is that is going on. Any help would be greatly appreciated!!
https://www.loom.com/share/53a65e02716046d0811c990013d6b06a
Solved! Go to Solution.
Hi @ngbrown24.
I have taken a look at your code... 2 pieces of news.
1. The good one is... here's the code that does what you want:
Monthly increase =
VAR _Prev_month =
CALCULATE (
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ),
PREVIOUSMONTH ( 'High Cost Claimant Summary De-I'[Date] )
)
VAR _Monthlyincrease =
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ) - _Prev_month
VAR _Previousdates =
CALCULATE (
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ),
FILTER (
'High Cost Claimant Summary De-I',
'High Cost Claimant Summary De-I'[Date]
< MAX ( 'High Cost Claimant Summary De-I'[Date] )
)
)
VAR _Total =
SUMX(
VALUES( 'Factor Set-up'[Plan Year Ending] ),
CALCULATE (
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ),
LASTDATE ( 'High Cost Claimant Summary De-I'[Date] )
)
)
RETURN
IF (
HASONEVALUE ( 'High Cost Claimant Summary De-I'[Date] ),
IF (
CONTAINS (
'Factor Set-up',
'Factor Set-up'[Plan Year Ending], VALUE ( YEAR ( PREVIOUSMONTH ( 'High Cost Claimant Summary De-I'[Date] ) ) )
),
_Monthlyincrease, // This was not here, the whole expression was duplicated
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ) // this should be made into a measure on its own
),
_Total
)
2. The bad one is... the model and DAX are NOT good. They violate so many principles of good dimensional design and writing good, performant, and correct DAX that I wouldn't even dare to put this in production. There are even too many violations for me to have space and time here to describe all of them and give reasons behind them.
Sorry about the criticism... but I just couldn't get over it without letting you know. I want you to know as well that you'll have big, big problems with this model down the road (and those who will come after you and will have to maintain it). Not to mention that you will not even be aware many of them at all.
Best
D
Hi @ngbrown24.
I have taken a look at your code... 2 pieces of news.
1. The good one is... here's the code that does what you want:
Monthly increase =
VAR _Prev_month =
CALCULATE (
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ),
PREVIOUSMONTH ( 'High Cost Claimant Summary De-I'[Date] )
)
VAR _Monthlyincrease =
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ) - _Prev_month
VAR _Previousdates =
CALCULATE (
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ),
FILTER (
'High Cost Claimant Summary De-I',
'High Cost Claimant Summary De-I'[Date]
< MAX ( 'High Cost Claimant Summary De-I'[Date] )
)
)
VAR _Total =
SUMX(
VALUES( 'Factor Set-up'[Plan Year Ending] ),
CALCULATE (
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ),
LASTDATE ( 'High Cost Claimant Summary De-I'[Date] )
)
)
RETURN
IF (
HASONEVALUE ( 'High Cost Claimant Summary De-I'[Date] ),
IF (
CONTAINS (
'Factor Set-up',
'Factor Set-up'[Plan Year Ending], VALUE ( YEAR ( PREVIOUSMONTH ( 'High Cost Claimant Summary De-I'[Date] ) ) )
),
_Monthlyincrease, // This was not here, the whole expression was duplicated
SUM ( 'High Cost Claimant Summary De-I'[Claims Paid] ) // this should be made into a measure on its own
),
_Total
)
2. The bad one is... the model and DAX are NOT good. They violate so many principles of good dimensional design and writing good, performant, and correct DAX that I wouldn't even dare to put this in production. There are even too many violations for me to have space and time here to describe all of them and give reasons behind them.
Sorry about the criticism... but I just couldn't get over it without letting you know. I want you to know as well that you'll have big, big problems with this model down the road (and those who will come after you and will have to maintain it). Not to mention that you will not even be aware many of them at all.
Best
D
@Anonymous Thank you! The criticism is appreciated. I have made a couple of tweaks that I think will help - I've swapped out the "contain" function for a selectedvalue function that I think will work better. It sounds like there are many other issues. Any tips would be appreciated. I'm pretty new to PowerBI (as you can tell).
Thank you!
This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
Thanks Greg, I actually looked at this post several times today, but it doesn't seem to get me what I need.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |