Forum Discussion

Thackeb's avatar
Thackeb
Advocate I
4 years ago
Solved

IF with AND

Asking for assistance with a Dax using If(And) or Switch. Please note that my tables are read only and I'm limited with using regular Dax.    Please assist if possible. Please note that my data tab...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Thackeb ,

     

    You could create a measure:

    measure = 
    IF(Category_2 in {"CUT SHEET PAPER", other values} && PFX_NUM in {"UNV", "OFF", "IVR", "UFS"}, "Excluded from Program", "Meets Criteria")

    You could also create slicers and use ALLSELECTED() or VALUES() function to get the dynamic value:

    measure = 
    IF(Category_2 in VALUES([column1]) && PFX_NUM in VALUES([column2]), "Excluded from Program", "Meets Criteria")

    If you want to calculate Sales based on the above conditions, you could refer:

    measure = 
    CALCULATE(sum(sales),Filter(ALLSELECTED('table'),Category_2 in {"CUT SHEET PAPER", other values} && PFX_NUM in {"UNV", "OFF", "IVR", "UFS"}))

     

    Best Regards,

    Jay