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

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

Reply
laverma
Regular Visitor

Table filter based on distinct value post filter based on one column - Logical

I have a source table below

laverma_2-1663659079922.png

 

 

1. I need to filter the table with the column as 'Assigned'(My assigned have userprinicpalname from office 365 and azure) = UserPrincipalName, with the result below

laverma_3-1663659104705.png

 

2. Get distinct from the 'Plan name' as below

laverma_4-1663659166485.png

 

3. Lastly with the above distinct value, filter the master table and get data as below

 

laverma_5-1663659295027.png

 

To summarize more

 

Get the distinct plan name of a user and apply the filter on the master table to get the output of all plans and actions of all users who are part of the same plan as the filtered user is

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

See if this works.

A) If the user is hard-coded: Create the following measure to use as a filter in the filter pane, setting the value to 1:

 

 

 

User 1 Plan Name =
VAR _U1 =
    CALCULATETABLE (
        VALUES ( fTable[Plan Name] ),
        ALL ( fTable ),
        fTable[Assigned] = "User 1"
    )
VAR _All =
    CALCULATETABLE ( VALUES ( fTable[Plan Name] ), ALL ( fTable[Assigned] ) )
RETURN
    COUNTROWS ( INTERSECT ( _All, _U1 ) )

 

 

 

result.png

 

B) If you need the User selection to be dynamic:

Create a new, independent table for Users (I've called mine 'Select Users"). Leave this new table unrelated in the model:

 

Select Users = 
DISTINCT(fTable[Assigned])

 

dim.png

 

model.png

 

Use this measure as a filter in the filter pane and set the value to 1:

 

 

Sel User Plan Name =
VAR _U1 =
    CALCULATETABLE (
        VALUES ( fTable[Plan Name] ),
        FILTER (
            ALL ( 'fTable' ),
            fTable[Assigned] IN VALUES ( 'Select Users'[Sel Assigned] )
        )
    )
VAR _All =
    VALUES ( fTable[Plan Name] )
RETURN
    COUNTROWS ( INTERSECT ( _All, _U1 ) )

 

 

dynamic.png

filter.gif

 

Attached is the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

5 REPLIES 5
laverma
Regular Visitor

@PaulDBrown Worked like a charm. Thanks a lot.

 

I did the following changes to get the currently logged-in user principal name and match it with the email address from the table, rest measures took care of it. 

User 1 Plan Name =
VAR _U1 =
    CALCULATETABLE (
        VALUES ( Sheet1[Planner_Name] ),
        ALL ( Sheet1 ),
        Sheet1[Email_Address] = USERPRINCIPALNAME()
    )
VAR _All =
    CALCULATETABLE ( VALUES ( Sheet1[Planner_Name] ), ALL ( Sheet1[Email_Address] ) )
RETURN
    COUNTROWS ( INTERSECT ( _All, _U1 ) )
laverma
Regular Visitor

@PaulDBrown I will implement same and update back.

PaulDBrown
Community Champion
Community Champion

See if this works.

A) If the user is hard-coded: Create the following measure to use as a filter in the filter pane, setting the value to 1:

 

 

 

User 1 Plan Name =
VAR _U1 =
    CALCULATETABLE (
        VALUES ( fTable[Plan Name] ),
        ALL ( fTable ),
        fTable[Assigned] = "User 1"
    )
VAR _All =
    CALCULATETABLE ( VALUES ( fTable[Plan Name] ), ALL ( fTable[Assigned] ) )
RETURN
    COUNTROWS ( INTERSECT ( _All, _U1 ) )

 

 

 

result.png

 

B) If you need the User selection to be dynamic:

Create a new, independent table for Users (I've called mine 'Select Users"). Leave this new table unrelated in the model:

 

Select Users = 
DISTINCT(fTable[Assigned])

 

dim.png

 

model.png

 

Use this measure as a filter in the filter pane and set the value to 1:

 

 

Sel User Plan Name =
VAR _U1 =
    CALCULATETABLE (
        VALUES ( fTable[Plan Name] ),
        FILTER (
            ALL ( 'fTable' ),
            fTable[Assigned] IN VALUES ( 'Select Users'[Sel Assigned] )
        )
    )
VAR _All =
    VALUES ( fTable[Plan Name] )
RETURN
    COUNTROWS ( INTERSECT ( _All, _U1 ) )

 

 

dynamic.png

filter.gif

 

Attached is the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






laverma
Regular Visitor

@PaulDBrown Could you please help  ?

laverma
Regular Visitor

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.