Forum Discussion
Anonymous
9 years agoNot applicable
DAX - IF Format
Hi All, I am trying to do a SUM on column [Total Amount] when column [Promotion_id] is blank AND column [order_order_scr] = 1 My DAX for new column is; NoOfferTotal = IF(AND(FORMAT([order...
- 9 years ago
v-jiascu-msft is right and it's a better solution in case that promition_id is actually "" in some cases.
revised codes:
measure = CALCULATE( SUM('POS Data 1'[Total Amount]), 'POS Data 1'[promotion_id] = BLANK(), 'POS Data 1'[order_order_src] = 1 ) column = IF( AND( 'POS Data 1'[promotion_id] = BLANK(), 'POS Data 1'[order_order_src] = 1 ), 'POS Data 1'[Total Amount] )
sdjensen
9 years agoSolution Sage
Hi Anonymous,
You can calculate this as a measure with this DAX code. I would however prefer to make the calculation a measure instead of a column unless you for some reason really need this as a column in your table.
NoOfferTotal =
CALCULATE(
SUM('POS Data 1'[Total Amount]),
FORMAT( 'POS Data 1'[promotion_id], "String" ) = "",
'POS Data 1'[order_order_src] = 1
)
If you really need it as a column - this code should do the trick:
IF(
AND(
FORMAT( 'POS Data 1'[promotion_id]; "String" ) = "",
'POS Data 1'[order_order_src] = 1
),
'POS Data 1'[Total Amount]
)