Forum Discussion

nmck86's avatar
nmck86
Post Patron
6 years ago
Solved

SWITCH FUNCTION OR IF HELP

I have a data set and I want when a state filter is not selected to show a column or measure with the pre_sales amount... when a state is selected I want it to show the total sales amount. Attaching ...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi, you could create a new measure like this:

     

    Measure = IF(ISFILTERED([State]), SUM(Sheet1[Pre Sales]), SUM(Sheet1[Total Sales]))

     

    The problem is that it doesn't work when you have State in the same table since state is filtered on each row. That could be solved by creating a new colum that is a copy of State and use that one in the table or slicer instead of State. It's not the best solution, but it works.