Forum Discussion

rvita0101's avatar
rvita0101
New Member
2 years ago
Solved

IF ELSE alternative solution

Hi,    I need help with the best way to approach this requirement. Technically I could write a long nested SWITCH and IF statements but it becomes clunky and difficult to maintain. I would really a...
  • vicky_'s avatar
    2 years ago

    I would create something like a lookup table, and then write a measure to calculate the corresponding sales rating:

    The table i created based on your sample data looks something like the above. I left the lower bounds empty for the High sales rating and just adjusted my DAX to handle that condition. Feel free to adjust as you need.

    Sales Rating = CALCULATE(MAX('Criteria Table'[Attribute]), FILTER('Criteria Table', SUM('Products Sold'[Sold]) >= COALESCE('Criteria Table'[Lower], 999999) && SUM('Products Sold'[Sold]) <= 'Criteria Table'[Upper]))