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
ctoscher
Helper I
Helper I

Using RLS with DAX SUM

We have a table with a measure that divides the Balance value of that row by the sum of the Balance column in that table (Concentration risk). This is what we get:

ClientAccountBalanceConcentration
ABC123456100.1
ABC123456200.2
ABC987654200.2

XYZ

234567

400.4
XYZ234567100.1

Using RLS (Modeling > View As) and specifying a client (ABC), we'd expect to get the following table:

ClientBalanceConcentration
ABC100.2
ABC200.4
ABC200.4

We instead get the following:

ClientBalanceConcentration
ABC100.1
ABC200.2
ABC200.2

This obviously doesn't make sense for our clients because their concentration would never be 100%.

It would also create an issue for us because now they can see how much their own concentration risk on our portfolio is (in the case above, 50%).

Our Concentration column is a measure set to the following:

 

Concentration = MyTable[Balance]/SUM(MyTable[Balance])

 

How can we limit the SUM to be specific to the user (client) viewing the report?

Separate to this, we have a filter that spans all reports for subaccounts, how can filter the values to show only relevant rows (Account in first table)?

1 ACCEPTED SOLUTION
edhans
Community Champion
Community Champion

You need to calculate the concentration on the fly as a measure, not rely on a balance row. The balance field won't recalculate based on RLS. Whatever is in a field is permenant until the next refresh.
It would need to be simlar to this:

 

Concentration = 
VAR varNumerator =
    SUM( 'Table'[Balance] )
VAR varDenominator =
    CALCULATE(
        SUM( 'Table'[Balance] ),
        REMOVEFILTERS( 'Table' )
    )
VAR Result =
    DIVIDE(
        varNumerator,
        varDenominator,
        0
    )
RETURN
    Result

 

edhans_0-1620079634057.png

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
edhans
Community Champion
Community Champion

You need to calculate the concentration on the fly as a measure, not rely on a balance row. The balance field won't recalculate based on RLS. Whatever is in a field is permenant until the next refresh.
It would need to be simlar to this:

 

Concentration = 
VAR varNumerator =
    SUM( 'Table'[Balance] )
VAR varDenominator =
    CALCULATE(
        SUM( 'Table'[Balance] ),
        REMOVEFILTERS( 'Table' )
    )
VAR Result =
    DIVIDE(
        varNumerator,
        varDenominator,
        0
    )
RETURN
    Result

 

edhans_0-1620079634057.png

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Wow this is fantastic, we're new to Power BI and still learning DAX. This'll be a powerful tool for us to use once we learn more!

edhans
Community Champion
Community Champion

Glad to help @ctoscher - It is an incredibly powerful tool. Learning DAX can be amazing and tricky at the same time. Post back with any questions to the forums. 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.