How to write an if statement using measure and Calculate to filter if (IS_CLAIMED) column equal "Null" then sum the (Paid_Amount) column ... using a DAX measure in Power BI?
0
votes
2 Answers
0
votes
0
votes
This measure should work
Amt =
CALCULATE (
SUM ( FACT[PAID_AMOUNT] ),
REMOVEFILTERS ( FACT ),
ISBLANK ( FACT[IS_CLAIMED] )
)
This first removes any existing filter over FACT table, then adds a filter to check that the IS_CLAIMED column is BLANK and computes the total using SUM.
If this should be a measure to be used inside Power BI visuals, that therefore needs to keeps existing filters over FACT table, then just the filter argument would be needed and the measure would become
Amt =
CALCULATE (
SUM ( FACT[PAID_AMOUNT] ),
ISBLANK ( FACT[IS_CLAIMED] )
)
N.B. nulls in Power Query becomes BLANKS when imported into the model