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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Irek
Helper II
Helper II

Filtering table by other table,

I have such table, need have functionality that allows me to filter it by slicer in such way that when I choose name for example Bob , my visualistion will show all rows where Bob appears in Key column. 

Data Table (visualisation table looks exactly the same)

NameKey
BobBob||Jimm||Ben
JimmBen||Jimm||Bob||Adam
Ben Ben||Jimm||Ben||Adam
Adam Jimm||Bob||Adam

 

I achieved it by using dax 

WordCount=
VAR SelectedWord = SELECTEDVALUE('Table'[Name])
RETURN
CALCULATE(
    COUNTROWS(Table),
    CONTAINSSTRING(Table[Key], SelectedWord)
)

 

 

I would prefer to do it by using calculated column but so far I couldnt make it. Any suggestions?

Second part of the task im struggling with is to make possible filter one table by another one in same way, 


Have two same looking visualisation tables. first filteres by slicer

When i select Bob in slicer im getting such table

NameKey
BobBob||Jimm||Ben
JimmBen||Jimm||Bob||Adam
Adam Jimm||Bob||Adam

 

Second filtered by first table

effect that I would like to get is when I click on Adam name is to get on second table visual such view

NameKey
JimmBen||Jimm||Bob||Adam
Adam Jimm||Bob||Adam



So when im choosing name I want to get rows where selected name appears in Key column. 

 

 

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

Hi, @Irek 

First, create a new table:

Table 2 = SELECTCOLUMNS('Table',"Name2",'Table'[Name])

vyohuamsft_0-1724380586445.png

 

Then create a new measure and try the following DAX:

Measure = 
VAR _Slicer =
    VALUES ( 'Table 2'[Name2])
VAR _vtable =
    ADDCOLUMNS (
        GENERATE ( 'Table', _Slicer ),
        "AAA", IF ( FIND ( [Name2], [Key],, BLANK () ) <> BLANK (), [Name2] )
    )
VAR _vtable2 =
    SUMMARIZE (
        _vtable,
        [Key],
        "BBB",
            IF (
                LEN ( CONCATENATEX ( _Slicer, [Name2] ) )
                    = LEN (
                        CONCATENATEX ( FILTER ( _vtable, [Key] = EARLIER ( [Key] ) ), [AAA] )
                    ),
                CONCATENATEX ( FILTER ( _vtable, [Key] = EARLIER ( [Key])), [AAA] )
            )
    )
RETURN

    IF (
        CONCATENATEX ( FILTER ( _vtable2, [Key] = 'Table'[Key]), [BBB] )
            <> BLANK (),
        CONCATENATEX ( FILTER ( _vtable2, [Key] = 'Table'[Key] ), [BBB] )
    )

When you select Bob, here is preview:

vyohuamsft_1-1724380731298.png

 

Then select Adam:

vyohuamsft_2-1724380758152.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

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

Hi, @Irek 

First, create a new table:

Table 2 = SELECTCOLUMNS('Table',"Name2",'Table'[Name])

vyohuamsft_0-1724380586445.png

 

Then create a new measure and try the following DAX:

Measure = 
VAR _Slicer =
    VALUES ( 'Table 2'[Name2])
VAR _vtable =
    ADDCOLUMNS (
        GENERATE ( 'Table', _Slicer ),
        "AAA", IF ( FIND ( [Name2], [Key],, BLANK () ) <> BLANK (), [Name2] )
    )
VAR _vtable2 =
    SUMMARIZE (
        _vtable,
        [Key],
        "BBB",
            IF (
                LEN ( CONCATENATEX ( _Slicer, [Name2] ) )
                    = LEN (
                        CONCATENATEX ( FILTER ( _vtable, [Key] = EARLIER ( [Key] ) ), [AAA] )
                    ),
                CONCATENATEX ( FILTER ( _vtable, [Key] = EARLIER ( [Key])), [AAA] )
            )
    )
RETURN

    IF (
        CONCATENATEX ( FILTER ( _vtable2, [Key] = 'Table'[Key]), [BBB] )
            <> BLANK (),
        CONCATENATEX ( FILTER ( _vtable2, [Key] = 'Table'[Key] ), [BBB] )
    )

When you select Bob, here is preview:

vyohuamsft_1-1724380731298.png

 

Then select Adam:

vyohuamsft_2-1724380758152.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

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

Thank you @v-yohua-msft , 

It works perfectly !

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.