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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

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

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.