Forum Discussion

IzuruWi's avatar
IzuruWi
Frequent Visitor
3 years ago
Solved

Convert SQL case statement to DAX

Hi all, I need some help with convert the below CASE statement to DAX query as a measure. Which should be able to execute in it's optimal perfomance state. ** I have mentioned the columns in the PB...
  • wdx223_Daniel's avatar
    wdx223_Daniel
    3 years ago

    NewMeasure=IF(MAX(DIM_ANALYTIC_STRUCT_ACCOUNT[STRUCTURE_NODE (groups)]) IN {"1 - CURRENT ASSETS","2 - NON - CURRENT ASSETS"},SUM ( FACT_CONSOL_BALANCE_OL[BALANCE] ),SUM ( FACT_CONSOL_BALANCE_OL[BALANCE] ) * -1)

    or 

    NewMeasure=IF(SELECTEDVALUE(DIM_ANALYTIC_STRUCT_ACCOUNT[STRUCTURE_NODE (groups)]) IN {"1 - CURRENT ASSETS","2 - NON - CURRENT ASSETS"},SUM ( FACT_CONSOL_BALANCE_OL[BALANCE] ),SUM ( FACT_CONSOL_BALANCE_OL[BALANCE] ) * -1)