Forum Discussion

jayjani's avatar
jayjani
Icon for Helper I rankHelper I
6 years ago

Measures Filters

Hello,

I created a table in PBI as shown below. I created all flag fields by writing measures such as

Price Flag = IF([Price]>=CALCULATE([Price], ALLSELECTED(Table[SKU]), "Avg or Above", "Below Avg")

 
But now I want to filter the list by Below Avg flag. Since, I cannot create a slicer filter using measure, I am wondering how can I do that.
Also, I want 3 separate slicer filters for all 3 flags so that users can filter based on their need.

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI jayjani,

    Measure formulas are calculated expressions that calculated based on current row contents and categories, it was not to use as the category to expand other fields. (slicer require static fields that measure formula not suitable for its requirement).

    Currently, you can only use measure on 'visual level filter' to filter records.
    If you want to direct choose measure results on the slicer, you need to create a table with measure formula results and coding measure filters based on its selection.

    New tables:

    FlagPrice =
    SELECTCOLUMNS ( { "Above Avg", "Below Avg" }, "Flag", [Value] )
    
    FlagDisc = FlagPrice
    
    FlagMargin = FlagPrice

    Measure filters use on the visual level filter to choose 1 result:

    PriceFilter=
    IF([Price Flag] in allselected(FlagPrice[Flag]),1,blank())
    
    DiscFilter=
    IF([Price Flag] in allselected(FlagDisc[Flag]),1,blank())
    
    MarginFilter=
    IF([Price Flag] in allselected(FlagMargin[Flag]),1,blank())

    Regards,

    Xiaoxin Sheng

    • jayjani's avatar
      jayjani
      Icon for Helper I rankHelper I

      In that example, you have a Products column which is used as a filter. What if I don't have any columns in my fact table. All are calculated measures and I want them as filter.