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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
Super User
Super User

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
Super User
Super User

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!

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors