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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors