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
DataEngineer314
Regular Visitor

Display Data Based on User Ownership in Power BI

I need a Power BI table to show:

  • Store Name
  • Rank
  • Total Gross Sales

The Store Name should only appear for stands the user owns. For non-owned stores, the Store Name should be blank, but Rank and Gross Sales should still be visible.

 

Do you have any advice to navigate this, more specifically how to still show data but not store name with RLS?

 

DataEngineer314_0-1731948059687.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DataEngineer314 ,
Thanks for dlopesc04 rerply.
The following is a realization and expansion of his response
Sample Data

RLS  
UserEmail Franchise_ID
A@email.com 1001
B@email.com 1002
C@email.com 1003

 

Fact_Store    
Franchise_ID Store_ID Store_Name
1001 101 One
1002 102 Two
1003 103 Three
1004 104 Four

 

Fact_Sales    
Store_ID Date Gross Sales
101 11/1/2024 100
102 11/1/2024 400
103 11/2/2024 300
104 11/3/2024 200

 

Create a new table

User_Store = 
SELECTCOLUMNS(
    Fact_Store,
    Fact_Store[Franchise_ID],
    Fact_Store[Store_ID],
    RELATED(Fact_Sales[Gross Sales])
)

Create measures

Store Name Display = 
VAR _ID = 
CALCULATE(
    MAX(Fact_Store[Franchise_ID]),
    FILTER(
        Fact_Store,
        RELATED(RLS[UserEmail]) = USERNAME()
    )
)
RETURN
IF(
    COUNTROWS(
        FILTER(
            User_Store,
            User_Store[Fact_Store_Franchise_ID] = _ID && 
            User_Store[Fact_Store_Store_ID] = SELECTEDVALUE(Fact_Store[Store_ID])
        )
    ) > 0,
    SELECTEDVALUE(Fact_Store[Store_Name]),
    BLANK()
)
Total Gross Sales = SUM(User_Store[Fact_Sales_Gross Sales])

Create a column

Rank = RANKX(User_Store,User_Store[Fact_Sales_Gross Sales],,)

Relationship

vheqmsft_0-1731982718706.png

Final output

vheqmsft_1-1731982760705.png

For RLS table you should use this code

vheqmsft_2-1731982830322.png

 

Best regards,
Albert He


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
Anonymous
Not applicable

Hi @DataEngineer314 ,
Thanks for dlopesc04 rerply.
The following is a realization and expansion of his response
Sample Data

RLS  
UserEmail Franchise_ID
A@email.com 1001
B@email.com 1002
C@email.com 1003

 

Fact_Store    
Franchise_ID Store_ID Store_Name
1001 101 One
1002 102 Two
1003 103 Three
1004 104 Four

 

Fact_Sales    
Store_ID Date Gross Sales
101 11/1/2024 100
102 11/1/2024 400
103 11/2/2024 300
104 11/3/2024 200

 

Create a new table

User_Store = 
SELECTCOLUMNS(
    Fact_Store,
    Fact_Store[Franchise_ID],
    Fact_Store[Store_ID],
    RELATED(Fact_Sales[Gross Sales])
)

Create measures

Store Name Display = 
VAR _ID = 
CALCULATE(
    MAX(Fact_Store[Franchise_ID]),
    FILTER(
        Fact_Store,
        RELATED(RLS[UserEmail]) = USERNAME()
    )
)
RETURN
IF(
    COUNTROWS(
        FILTER(
            User_Store,
            User_Store[Fact_Store_Franchise_ID] = _ID && 
            User_Store[Fact_Store_Store_ID] = SELECTEDVALUE(Fact_Store[Store_ID])
        )
    ) > 0,
    SELECTEDVALUE(Fact_Store[Store_Name]),
    BLANK()
)
Total Gross Sales = SUM(User_Store[Fact_Sales_Gross Sales])

Create a column

Rank = RANKX(User_Store,User_Store[Fact_Sales_Gross Sales],,)

Relationship

vheqmsft_0-1731982718706.png

Final output

vheqmsft_1-1731982760705.png

For RLS table you should use this code

vheqmsft_2-1731982830322.png

 

Best regards,
Albert He


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

 

 

 

dlopesc04
Resolver II
Resolver II

Duplicate your fact table and remove the store name column from the second table.

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.