The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi (first time poster but have used a lot of solutions provided within the pages)
I have a fact table that i need it identify a MoM (Month On Month) change by a certain measure. Which i can do however i now need to do it on a subset of the fact table. Only the records that have had a claim (for example the table has 10,000 records of which only 2,000 have a claim). I need to isolate the calculation to just these records. For all the measures so far this has been achieved with the filter function. However I now need to Filter on Date and a text field. (hope that all makes sense).
The code that i am trying to use (i think is correct as far as the syntax goes) is:
I think you've put the claim status check in the wrong place, in the middle of the check for month rank. Try
claimMoM =
VAR cLMeasy =
CALCULATE (
Key_measures[%Easy],
ALL ( Dim_datet ),
Dim_Datet[Month Rank]
= MIN ( 'DIM_DateT'[Month Rank] ) - 1,
Dim_ClaimStatus[ClaimSts] IN { "Fault", "Non-Fault" }
)
RETURN
IF ( cLMeasy = 0, BLANK (), Key_measures[%Easy] - cLMeasy )
@Shorey not sure but I copied the code you sent and seems there was a mix in the lines. I just replaced the lines, try this and tell me if you get the error:
claimMoM =
VAR cLMeasy =
CALCULATE (
Key_measures[%Easy],
ALL ( Dim_datet ),
Dim_Datet[Month Rank]
= MIN ( 'DIM_DateT'[Month Rank] ) - 1,
Dim_ClaimStatus[ClaimSts] IN { "Fault", "Non-Fault" }
)
RETURN
IF ( cLMeasy = 0, BLANK (), Key_measures[%Easy] - cLMeasy )
Thanks for your reply @SpartaBI that is much easier to read (i must get in the habit of laying the code like that). However I no longer get the error but it is returning the same result i had before i tried to put the fault non-fault filter in - which suggests it isn't filtering on this factor. I think it needs to be within the one calculation for the min statement. I moved it up to after the key_measure, but that didn't work either. (no error message just not the correct result).
Thanks for trying though.
User | Count |
---|---|
11 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
14 | |
14 | |
9 | |
7 |