Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Measure as filter

Hi Guys.   I have a formula that works correctly, but if you did not select any filter, mark  an error, how can I do it so that if I do not have anything selected, show me the 3 values.   Measure...
  • Nishantjain's avatar
    8 years ago

    Anonymous, I don't think this is possible by using a Switch function. Switch will always return 1 measure.

     

    I would suggest you try the following:

     

    Step 1: Add all 3 measures in your bar chart. Make sure that your measure uses both "Calculate" and "Filter" function 

    e.g. CALCULATE(SUM(VALUES),FILTER(TABLE, TABLE[ACCOUNT] = "TOTAL SALES"

     

    Step 2: Create a slicer for your accounts i.e. "Total Sales", "Total costs" and "Total Profit". 

     

    Now when you select nothing in the slicer, all the measures should be visible. If you select any one value, only that measure is shown. 

     

    Hope this help

    Nishant

  • Anonymous's avatar
    Anonymous
    8 years ago

    Create a Selection Table that contains 2 fields.  A numeric ID column and a String Text column.  Create a slicer that will display the values in your Selection Table.  When any of these selections are chose, the context of Power BI will filter down to just that single row.

     

    Now if you do a MIN('Selection Table'[ID]) you will know the value of your selection.  If nothing is selected you will get the smallest value in your selection table, which you could make as "(Blank)"

     

    From here, you could use that within a Switch statement to run different measures depending on the Values in you selection table.  So 0 could equal "Error Message", 1 could be your first measure, 2 could be your second measure and so forth.