Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Use measure as filter

Hi everyone!

 

I'm trying to filter a table by a value that is stored in a measure. I'm not being able to do it. Is it even possible?

 

For example: I want to show in a visualization just the accounts where the doc type is "AA". This doc type "AA" is stored in the measure.

 

I know I could do it directly from the "Filter" section, but this dashboard is going to be used in different places, and the doc type may have a different value. I want to make the customization as user friendly as possible.

 

I'll appreciate any help.

Thank you!

  • Hi Anonymous ,

     

    Measure cannot be used as a slicer, but a similar effect can be achieved in other ways:

    Switch =
    SWITCH (
        SELECTEDVALUE ( Table_2[Date] ),
        DATE ( 2022, 01, 01 ), [Measure1],
        DATE ( 2022, 01, 02 ), [Measure2],
        DATE ( 2022, 01, 03 ), [Measure3]
    )

     

     

    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


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

7 Replies

  • tackytechtom's avatar
    tackytechtom
    Most Valuable Professional

    Hi Anonymous ,

     

    You cannot use a measure directly in a slicer. However, there are some workarounds available. Have a look in here:

    Solved: Cannot use measure in slicer - Microsoft Power BI Community

    Power BI - Filter by a Measure in a Slicer - YouTube

     

    Let me know if this works, or in case you get stuck somewhere.

     

    Please, accept this answer as solution, if it solves your issue 🙂

     

    /Tom
    https://www.tackytech.blog/
    https://www.instagram.com/tackytechtom/

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the suggestion. I couldn't make it work so far, but I managed to solve it for now by using a new input with the info that I wanted to store in the measure. 

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi Anonymous ,

     

    Measure cannot be used as a slicer, but a similar effect can be achieved in other ways:

    Switch =
    SWITCH (
        SELECTEDVALUE ( Table_2[Date] ),
        DATE ( 2022, 01, 01 ), [Measure1],
        DATE ( 2022, 01, 02 ), [Measure2],
        DATE ( 2022, 01, 03 ), [Measure3]
    )

     

     

    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your help. It was very clear. But I had some troubles with it so I decided to use a new input with the info I wanted to store in the measure and it's working. 

      Thanks again.

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi Anonymous ,

     

    Thanks for your feedback.

     

    If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


    Best Regards,
    Henry

  • Anonymous's avatar
    Anonymous
    Not applicable

    I've 2 measures

    • Utilization of Employees

    • Status (If they have achieved targeted utilization or not). In this case, 1 = Greater than or equal to Target; 2 & 3 = less than target

     

    I want a visual which should give count of Employees who are less than the target (when status = 2 / 3). Can someone help me to arrive this?

    *FLM, FTE and Agency are Employee types and row header denotes the Section names

  • I used the mentioned formula and it came out, but I have a detail. Is that the option is for single selection, but if I want to select several options of the filter, would there be way? I looked for other alternatives, but I was not given.