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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Maghed
Frequent Visitor

get distinct value of table column based on a slicer selected value

Capture.PNGCapture1.PNG

If I select a Brand from slicer, I need to create a new table with Distinct values of colmun color ie:

reult will be a new calculated table with 3 colors Red,Green, Blue

Thank you

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

Hi @Maghed ,

 

According to your description, I created a sample and here is my solution.

Firstly, you can create a new table by using SUMMARIZE function to reference the "color" column.

Table_summarize =
SUMMARIZE ( 'Table', 'Table'[Colors] )

Then, create a measure to connect with the slicer.

control =
VAR _slice =
    SELECTEDVALUE ( 'Table'[Brand] )
RETURN
    IF (
        COUNTROWS (
            FILTER (
                'Table',
                SEARCH ( MAX ( 'Table_summarize'[Colors] ), MAX ( 'Table'[Colors] ),, -1 )
            )
        ) > 0,
        1,
        BLANK ()
    )

Remember to establish a relationship between two tables.

vxiaosunmsft_0-1667287770251.png

Then you will get the expected output.

vxiaosunmsft_1-1667287808937.png

And I've also created an additional example to give you a clearer view of how the formula works.

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

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

2 REPLIES 2
v-xiaosun-msft
Community Support
Community Support

Hi @Maghed ,

 

According to your description, I created a sample and here is my solution.

Firstly, you can create a new table by using SUMMARIZE function to reference the "color" column.

Table_summarize =
SUMMARIZE ( 'Table', 'Table'[Colors] )

Then, create a measure to connect with the slicer.

control =
VAR _slice =
    SELECTEDVALUE ( 'Table'[Brand] )
RETURN
    IF (
        COUNTROWS (
            FILTER (
                'Table',
                SEARCH ( MAX ( 'Table_summarize'[Colors] ), MAX ( 'Table'[Colors] ),, -1 )
            )
        ) > 0,
        1,
        BLANK ()
    )

Remember to establish a relationship between two tables.

vxiaosunmsft_0-1667287770251.png

Then you will get the expected output.

vxiaosunmsft_1-1667287808937.png

And I've also created an additional example to give you a clearer view of how the formula works.

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

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

 

Great Support. Thank you ✌️

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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