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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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