Forum Discussion
apollo89
8 years agoHelper II
SQL CASE Statement to DAX Measure
Hi All, Need help to replicate the below Case statement into a DAX measure: SUM( CASE WHEN VALUE_TYPE = '070' AND VALUE_TYPE_DETAIL = '06' THEN AMOUNT ...
- 8 years ago
Yes, sorry I misunderstood your goal. Try this, it should perform much better as well.
TEST = CALCULATE ( SUM ( 'TableName'[Amount] ), 'TableName'[VALUE_TYPE] = "070", 'TableName'[VALUE_TYPE_DETAIL] = "06" )
jmalone
8 years agoResolver III
TEST =
IF (
SELECTEDVALUE ( 'TableName'[VALUE_TYPE] ) = "070"
&& SELECTEDVALUE ( 'TableName'[VALUE_TYPE_DETAIL] ) = "06",
SUM ( 'TableName'[AMOUNT] ),
0
)- apollo898 years agoHelper II
Thank you for your response jmalone.
However this gives me a 0 in each row as well as a 0 in the grand total.
Moreover, this measure was very slow to populate (I am working with a million records)
Any ideas?
- jmalone8 years agoResolver III
Yes, sorry I misunderstood your goal. Try this, it should perform much better as well.
TEST = CALCULATE ( SUM ( 'TableName'[Amount] ), 'TableName'[VALUE_TYPE] = "070", 'TableName'[VALUE_TYPE_DETAIL] = "06" )