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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sblue
Frequent Visitor

Table with Records similar to current Selection

 

I have a table with multiple columns and records. I am using slicers to filter this table for my report.

 

What I am having problems with is the following:

I am trying to generate a table (to be displayed as a visual) with records similar (based on a common field value) to current filtered records.

 

Example:

TABLE Account

 

ID    AccountNumber   AccountName   AccountType

1          AN192345           Aaa                    Type1

2          AN199833           Baa                    Type2         

3          AN192167           Caa                    Type1

4          AN192341           Aca                    Type1

5          AN192342           Dda                    Type2

6          AN192343           Bdd                    Type3

7          AN192344           Eee                     Type1

 

 

 

Slicers:

AccountNumber = AN192345 

AccountType = Type1

 

I want to know which accounts share the same first 6 characters of the selected account ("AN1923")

Something like: "Select rows from TableA where left(Accountnumber,6)  =  left(SlicerSelection(Accountnumber),6)"

 

Expected Output:

 

ID    AccountNumber   AccountName   AccountType

1          AN192345           Aaa                    Type1     

4          AN192341           Aca                    Type1

5          AN192342           Dda                    Type2

6          AN192343           Bdd                    Type3

7          AN192344           Eee                     Type1

 

 

 

Any help is much appreciated.

 

 

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Sblue

 

First, you may create a new table as Slicer Table:

 

Slicer =
DISTINCT ( 'TABLE Account'[AccountNumber] ) 

Second, you may try to create measure as below:

Measure =
IF (
    HASONEVALUE ( Slicer[AccountNumber] ),
    IF (
        LEFT ( VALUES ( 'TABLE Account'[AccountNumber] ), 6 )
            = LEFT ( SELECTEDVALUE ( Slicer[AccountNumber] ), 6 ),
        1
    )
)

aa.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
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-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Sblue

 

First, you may create a new table as Slicer Table:

 

Slicer =
DISTINCT ( 'TABLE Account'[AccountNumber] ) 

Second, you may try to create measure as below:

Measure =
IF (
    HASONEVALUE ( Slicer[AccountNumber] ),
    IF (
        LEFT ( VALUES ( 'TABLE Account'[AccountNumber] ), 6 )
            = LEFT ( SELECTEDVALUE ( Slicer[AccountNumber] ), 6 ),
        1
    )
)

aa.png

 

Regards,

Cherie

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

Thanks Cherie, this worked!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.