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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AndrejZitnay
Post Patron
Post Patron

Slicer out of two data sources

Hello all,

 

I was wondering if you could help me out. I have my visuals (table) where I need to drill down by two slicers which are from two different data sources.

 

I am hoping to have only one slicer with following 5 conditons as it is quite difficult to use two slicer with given condtions.

 

Is there any smart way how to achive that?

Slicer question.JPG

Many thanks.

 

Kind regards.

 

Andrej

 

1 ACCEPTED SOLUTION

Hi @AndrejZitnay 

Create a table by entering data, don't create any relationship for this table

category
category1
category2
category3
category4
category5

 

Create columns in main table

12.png

1 =
IF (
    [category] IN { "Train" }
        && FIND (
            [Number],
            FORMAT (
                CONCATENATEX ( VALUES ( 'main table'[Number] ), [Number], "," ),
                "General Number"
            ),
            1,
            0
        ) > 0,
    "category1"
)

4 =
IF (
    [category] IN { "Car", "Airplane", "Train" }
        && FIND (
            [Number],
            FORMAT (
                CONCATENATEX ( VALUES ( 'main table'[Number] ), [Number], "," ),
                "General Number"
            ),
            1,
            0
        ) > 0,
    "category4"
)

5 =
IF (
    [category] IN { "Car", "Airplane", "Train", "Boat" }
        && FIND (
            [Number],
            FORMAT (
                CONCATENATEX ( VALUES ( 'main table'[Number] ), [Number], "," ),
                "General Number"
            ),
            1,
            0
        ) > 0,
    "category5"
)

3 =
IF (
    [category] IN { "Car", "Airplane", "Train" }
        && FIND (
            [Number],
            CONCATENATEX (
                FILTER ( VALUES ( 'main table'[Number] ), NOT [Number] IN { 5649 } ),
                [Number],
                ","
            ),
            1,
            0
        ) > 0,
    "category3"
)


2 =
IF (
    [category] IN { "Car", "Airplane", "Train" }
        && FIND (
            [Number],
            CONCATENATEX (
                FILTER ( VALUES ( 'main table'[Number] ), NOT [Number] IN { 6546, 5649 } ),
                [Number],
                ","
            ),
            1,
            0
        ) > 0,
    "category2"
)

Then

Add "category" in a slicer

create a measure in main table

Measure =
SWITCH (
    SELECTEDVALUE ( 'slicer table'[category] ),
    "category1", IF ( MAX ( 'main table'[1] ) = "category1", 1 ),
    "category2", IF ( MAX ( 'main table'[2] ) = "category2", 1 ),
    "category3", IF ( MAX ( 'main table'[3] ) = "category3", 1 ),
    "category4", IF ( MAX ( 'main table'[4] ) = "category4", 1 ),
    "category5", IF ( MAX ( 'main table'[5] ) = "category5", 1 )
)

11.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
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-juanli-msft
Community Support
Community Support

Hi @AndrejZitnay 

You could use filter pane to filter the "Number" in excel

4.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-juanli-msft 

Thanks for your help.
I am aware of filters but that is not what I need.

I have table with lots of variables. This table is linked via relationships to two separate data sources Excel 1 & Excel 2 which works as slicers . At the moment I can work with my table with two separate Slicers : Category & Number

I need to create 1 slicer which will meet my conditions for Category 1-5.

Hope that make sense.
Here is picture with further explanation.

Slicer question 2.JPG

 

Many thanks.

 

Kind regards.

 

Andrej

 

 

 

 

 

 

 

Hi @AndrejZitnay 

Create a table by entering data, don't create any relationship for this table

category
category1
category2
category3
category4
category5

 

Create columns in main table

12.png

1 =
IF (
    [category] IN { "Train" }
        && FIND (
            [Number],
            FORMAT (
                CONCATENATEX ( VALUES ( 'main table'[Number] ), [Number], "," ),
                "General Number"
            ),
            1,
            0
        ) > 0,
    "category1"
)

4 =
IF (
    [category] IN { "Car", "Airplane", "Train" }
        && FIND (
            [Number],
            FORMAT (
                CONCATENATEX ( VALUES ( 'main table'[Number] ), [Number], "," ),
                "General Number"
            ),
            1,
            0
        ) > 0,
    "category4"
)

5 =
IF (
    [category] IN { "Car", "Airplane", "Train", "Boat" }
        && FIND (
            [Number],
            FORMAT (
                CONCATENATEX ( VALUES ( 'main table'[Number] ), [Number], "," ),
                "General Number"
            ),
            1,
            0
        ) > 0,
    "category5"
)

3 =
IF (
    [category] IN { "Car", "Airplane", "Train" }
        && FIND (
            [Number],
            CONCATENATEX (
                FILTER ( VALUES ( 'main table'[Number] ), NOT [Number] IN { 5649 } ),
                [Number],
                ","
            ),
            1,
            0
        ) > 0,
    "category3"
)


2 =
IF (
    [category] IN { "Car", "Airplane", "Train" }
        && FIND (
            [Number],
            CONCATENATEX (
                FILTER ( VALUES ( 'main table'[Number] ), NOT [Number] IN { 6546, 5649 } ),
                [Number],
                ","
            ),
            1,
            0
        ) > 0,
    "category2"
)

Then

Add "category" in a slicer

create a measure in main table

Measure =
SWITCH (
    SELECTEDVALUE ( 'slicer table'[category] ),
    "category1", IF ( MAX ( 'main table'[1] ) = "category1", 1 ),
    "category2", IF ( MAX ( 'main table'[2] ) = "category2", 1 ),
    "category3", IF ( MAX ( 'main table'[3] ) = "category3", 1 ),
    "category4", IF ( MAX ( 'main table'[4] ) = "category4", 1 ),
    "category5", IF ( MAX ( 'main table'[5] ) = "category5", 1 )
)

11.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-juanli-msft ,

 

That will work me!!

 

Thank you so much.

 

Kind regards.

 

Andrej

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.