Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
gelsonwirtijr
Frequent Visitor

how to use a ranking dax measure as a filter

Hello everybody! I created a dax measure to calculate how much customers spent in different fiscal years and another dax measure to rank these customers based on their spending. I would like to use slicer (picture below)

gelsonwirtijr_0-1694010163800.png

so that in a table, for example, it only shows customers classified as "K", "A", "B" or "C". But this visual does not accept DAX measures.

Below is my measure that makes the classification of customers:

Classificação Cliente Peças =
VAR TotalServicos = [Realizado]
RETURN
    SWITCH(
        TRUE(),
        TotalServicos >= 1000000, REPT(UNICHAR(8203),1) & "K",
        TotalServicos >= 300000 && TotalServicos < 1000000, REPT(UNICHAR(8203),2) & "A",
        TotalServicos >= 50000 && TotalServicos < 300000, REPT(UNICHAR(8203),3) & "B",
        TotalServicos < 50000, REPT(UNICHAR(8203),4) & "C",
        BLANK()
    )


What can I do to be able to filter based on the client's class?
1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @gelsonwirtijr 

 

You can try the following methods.
Create a new slicer table:

vzhangti_0-1694170944621.png

Measure = IF(SELECTEDVALUE(Slicer[Slicer])=BLANK(),1,IF(SELECTEDVALUE(Slicer[Slicer])=[Classificação Cliente Peças],1,0))

vzhangti_1-1694170977149.png

vzhangti_2-1694171012154.png

You can filter the views by this method.

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @gelsonwirtijr 

 

You can try the following methods.
Create a new slicer table:

vzhangti_0-1694170944621.png

Measure = IF(SELECTEDVALUE(Slicer[Slicer])=BLANK(),1,IF(SELECTEDVALUE(Slicer[Slicer])=[Classificação Cliente Peças],1,0))

vzhangti_1-1694170977149.png

vzhangti_2-1694171012154.png

You can filter the views by this method.

 

Best Regards,

Community Support Team _Charlotte

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

Hi @v-zhangti, I have a similar problem. The strategy worked to visualize the data in a table, but it doesn't work on a card, as it is not possible to put "Filtros_Peças is 1 ". Can you help me?

gelsonwirtijr_0-1694618450728.png

 

 

Hello @v-zhangti , thanks for the help! I don't know why, but he's not behaving the same way he did with you.

gelsonwirtijr_0-1694177713656.png

I created a table with the classes and followed the same steps.

gelsonwirtijr_1-1694177806913.png

 

The problem was REPT(), it worked, thank you!

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors