目标:
我想在查询中添加一个IF
条件,但不确定如何。换句话说,将MAX表达式替换为下面的IF语句
IF条件为:
IF(
'Data Model'[amount] = 'Data Model'[orderTotalPrice],
'Data Model'[amount] - 'Data Model'[shipping_price] - 'Data Model'[total_tax],
'Data Model'[amount]
)
我的查询:
VAR Summary =
CALCULATETABLE(SUMMARIZE (
'Data Model',
'Data Model'[orderId],
"MaxValue", CALCULATE (
MAX ( 'Data Model'[amount] ),
'Data Model'[kind] = "refund",
'Data Model'[status] = "success"
)
),USERELATIONSHIP ( 'Data Model'[trx_date], DateTable[Date] ))
RETURN
SUMX ( Summary, [MaxValue] )