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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
klllmmm
Regular Visitor

How create a combined slicer using several fields

I have a data table with several columns that you want to use to create a slicer, where if the selected value is found in any of such columns, then such a line has to appear.

 

klllmmm_0-1668937299318.png

For example, I want to create a slicer with a list Key of options "A", "B" & "C".
When the user selects any or multiple items from the slicer such line items containing 1 in those respective columns have to appear.
If the user selects/ticks slicer options A & B, then A, D, F, & G rows should appear.
https://1drv.ms/u/s!An03iU493hAgnpwhuu6i7Rs59CXiRw?e=6NZnKv 

Can someone help me how to achieve this?

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @klllmmm ,

 

Here are the steps you can follow:

1. Power Query – Copy Table1 to form Table2..

vyangliumsft_0-1669107973980.png

2. Select – [Key_A], [Key_B], [Key_C] – Unpivot Columns.

vyangliumsft_1-1669107973983.png

Result:

vyangliumsft_2-1669107973985.png

3. Create column calculated.

Slicer table =
DISTINCT('Table2'[Attribute])

vyangliumsft_3-1669107973986.png

4. Create measure.

Flag =
var _select=SELECTCOLUMNS('Slicer table',"1",[Attribute])
return
IF(
    MAX('Table'[Category]) in
SELECTCOLUMNS(FILTER(ALL('Table2'),'Table2'[Attribute] in _select),"2",[Category]) ,1,0)

5. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_4-1669107973987.png

6. Result:

vyangliumsft_5-1669107973988.png

 

Best Regards,

Liu Yang

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-yangliu-msft
Community Support
Community Support

Hi  @klllmmm ,

The SELECTCOLUMN function refers to saving the returned results to form a table, where "2" is a column name of the table, you can choose any name.

Refer to:

SELECTCOLUMNS function (DAX) - DAX | Microsoft Learn

IF(
    MAX('Table'[Category]) in
SELECTCOLUMNS(FILTER(ALL('Table2'),'Table2'[Attribute] in _select),"2",[Category]) ,1,0)

This function represents:

When the data in column [Category] exists in column [2] formed using the SELECTCOLUMN function, 1 is returned, otherwise 0.

 

Best Regards,

Liu Yang

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

v-yangliu-msft
Community Support
Community Support

Hi  @klllmmm ,

 

Here are the steps you can follow:

1. Power Query – Copy Table1 to form Table2..

vyangliumsft_0-1669107973980.png

2. Select – [Key_A], [Key_B], [Key_C] – Unpivot Columns.

vyangliumsft_1-1669107973983.png

Result:

vyangliumsft_2-1669107973985.png

3. Create column calculated.

Slicer table =
DISTINCT('Table2'[Attribute])

vyangliumsft_3-1669107973986.png

4. Create measure.

Flag =
var _select=SELECTCOLUMNS('Slicer table',"1",[Attribute])
return
IF(
    MAX('Table'[Category]) in
SELECTCOLUMNS(FILTER(ALL('Table2'),'Table2'[Attribute] in _select),"2",[Category]) ,1,0)

5. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_4-1669107973987.png

6. Result:

vyangliumsft_5-1669107973988.png

 

Best Regards,

Liu Yang

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 for this answer!!!

One more thing. 

In the step no 4, SELECTCOLUMN function what is referred from "2" ? 

daXtreme
Solution Sage
Solution Sage

Such problems have been solved on this forum countless times. Please use the Search box to find them. Also, on YT there are vids (some by Alberto Ferrari) that show how to use a slicer to get the OR semantics instead of AND (because this is what you're actually asking for).

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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