Forum Discussion

tamnguyenEPM's avatar
tamnguyenEPM
New Member
5 years ago
Solved

Measure in Slicer

Hello everyone,

Hope you're all well. 

 

I have a measure as below: 

ID-Print = CALCULATE(count(RisksRegister[Index]),FILTER(ALLSELECTED(RisksRegister),RisksRegister[Index]<= MAX(RisksRegister[Index])))
 
I did a few search on the forum and can't find any applicable solution to my situation. 
I'm trying to add a slicer with the ability to group the ID-Print into range one: 1-6, 7-12, 13-18. 
So I can select the proper range - display them in the report and print them. 

Unfortunately the slicer won't accept the measure as value. 
Can you please help ? 

Thank you !
  • Hi tamnguyenEPM ,

     

    You can create a new table for slicer:

     

     

    Then you can create the following visual level filter and add it to the visual you want to filter by slicer:

    measure = IF(ISFILTERED('Table'[Value]),IF([ID-Print]>= MAX('Table'[left]) &&[ID-Print] <=MAX('Table'[right]),1,0),1)

     

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai

     

3 Replies

  • edhans's avatar
    edhans
    Icon for Community Champion rankCommunity Champion

    You must create either a calculated column in DAX or a custom column in Power Query. Measures always only have 1 value so even if you could add it to a slicer it would be one value. They only seem to have multiple values because they recalculate different ways depending on the filter context, say rows in a table visual, or per the axis of a bar chart.

     

    And you cannot use ALLSELECTED in a calculated column. Calculated columns only calculate at refresh before any selections are evaluated so it will not return expected results, and user selection will do nothing.

     

    Perhaps you can share some data and give us some screenshots of expected results.

  • v-deddai1-msft's avatar
    v-deddai1-msft
    Icon for Community Support rankCommunity Support

    Hi tamnguyenEPM ,

     

    You can create a new table for slicer:

     

     

    Then you can create the following visual level filter and add it to the visual you want to filter by slicer:

    measure = IF(ISFILTERED('Table'[Value]),IF([ID-Print]>= MAX('Table'[left]) &&[ID-Print] <=MAX('Table'[right]),1,0),1)

     

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai