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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MM2023
Frequent Visitor

Power bi slicer logic

Hi All,

I am new to Power bi and need some help with the slicer logic.

Here is my test data.

Customer Type
10A
10B
11A
11B
12A
12B
13A
13B
14A
14B

 

When the user selects 12A, ONLY the below data should be visible in the report.

10A
10B
11A
11B
12A

And if the user selects 12B, only the below data should be visible in the report.

10A
10B
11A
11B
12B
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@MM2023 , You need to create two independent table

 

Customer  = Distinct(Table[Customer])

Type = Distinct(Table[Type])

 

Use them in a slicer and have measure like, and use with your original table column

 

Measure =

var _tab = summarize(filter(Table, Table[Type] in Values(Type[Type])  && not(Table[Customer] in Values(Customer[Customer]))  ), Table[Customer])

return

countrows( filter( Table, ( Table[Type] in Values(Type[Type])  && (Table[Customer] in Values(Customer[Customer])) )

|| Table[Customer] in _tab  ))

View solution in original post

v-yueyunzh-msft
Community Support
Community Support

Hi , @MM2023 

Here are the steps you can refer to :
We need to click "New Table" to create a table as a slicer:

Slicer = ADDCOLUMNS('Table' ,"Combine", CONCATENATE([Customer],[Type]))

 Then we can create a measure :

Measure = var _s_customer =MAX('Slicer'[Customer])
var _s_type = MAX('Slicer'[Type])
var _cur_customer = MAX('Table'[Customer])
var _cur_type = MAX('Table'[Type])
return
IF(_cur_customer< _s_customer ,1 , IF(_cur_customer=_s_customer &&_s_type=_cur_type,1,0  ))

Then we can put the 'Slicer'[Combine] on the slicer visual and configure the measure on the "Filter on this visual" and we can meet your need:

vyueyunzhmsft_0-1674443744990.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

6 REPLIES 6
v-yueyunzh-msft
Community Support
Community Support

Hi , @MM2023 

Here are the steps you can refer to :
We need to click "New Table" to create a table as a slicer:

Slicer = ADDCOLUMNS('Table' ,"Combine", CONCATENATE([Customer],[Type]))

 Then we can create a measure :

Measure = var _s_customer =MAX('Slicer'[Customer])
var _s_type = MAX('Slicer'[Type])
var _cur_customer = MAX('Table'[Customer])
var _cur_type = MAX('Table'[Type])
return
IF(_cur_customer< _s_customer ,1 , IF(_cur_customer=_s_customer &&_s_type=_cur_type,1,0  ))

Then we can put the 'Slicer'[Combine] on the slicer visual and configure the measure on the "Filter on this visual" and we can meet your need:

vyueyunzhmsft_0-1674443744990.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Thank you so much @v-yueyunzh-msft. Excellent solution 🙂

amitchandak
Super User
Super User

@MM2023 , You need to create two independent table

 

Customer  = Distinct(Table[Customer])

Type = Distinct(Table[Type])

 

Use them in a slicer and have measure like, and use with your original table column

 

Measure =

var _tab = summarize(filter(Table, Table[Type] in Values(Type[Type])  && not(Table[Customer] in Values(Customer[Customer]))  ), Table[Customer])

return

countrows( filter( Table, ( Table[Type] in Values(Type[Type])  && (Table[Customer] in Values(Customer[Customer])) )

|| Table[Customer] in _tab  ))

Thank you for trying  @amitchandak. This won't work. Thanks again.

@MM2023 , Please share the logic, I done it based on what I got

@amitchandak I already asked what  I want in my post. Looks like you did not read my post. 

 

Can someone HELP me? It s very urgent. Thank you.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.