Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
I am getting incorrect totals for a calculated column because row-level security filtering is happening after a CALCULATE() expression.
I have read it's not ideal design to have RLS applied to the fact table, but I have an OR condition from two different dimensions that need to be applied.
From my fact table of transactions, I have foreign keys to both a manager and partner dimension. My RLS rule is roughly:
RELATED(MANAGER[Email]) = USERPRINCIPALNAME() || RELATED(PARTNER[Email]) = USERPRINCIPALNAME()
I have a third dimension table, Client. I want to aggregate a total realization % for the Current Year only in the client table. I then want to bring this summary calculation into a column in the Client table so that I can create a dimension that can be used in a visual to segment overperforming/underperforming clients.
To start, I built a calculation to return the appropriate sums only for the current year, of the form: CALCULATE(SUM(FACT_TABLE[Amount]), DATE_TABLE[YEAR] = DATE_TABLE[CURRENT_YEAR]).
But when I bring this calculation into a calculated column in the Client table, it ignores the Row-Level security filters, showing me the total for that client across all Managers and Partners.
This is not the case when I create a new calculated column in the Fact table that only includes current year values. If I create this column, the RLS rules are properly applied.
This column is of the form: IF(RELATED(DATE_TABLE[YEAR]) = DATE_TABLE[CURRENT_YEAR], AMOUNT, 0).
Perhaps it's a Tableau background, but this order of operations is a little confusing to me, that RLS rules are applied after a calculated column is computed. I would expect that RLS rules are applied to all tables first.
I would also expect that my filtering within CALCULATE() would essentially operate over a column of values equivalent to IF(RELATED(DATE_TABLE[YEAR]) = DATE_TABLE[CURRENT_YEAR], AMOUNT, 0). In either case, I think the expectation is that Row-Level Security truly means that any rows not meeting the RLS criteria are not available in any way to calculations, whether columns or measures.
Perhaps this isn't a bug, but I think the community would really benefit from a clear description of this filtering "order of operations" as Tableau has available. This behavior was entirely not clear to me until I did more extensive testing and it seems quite counter-intuitive to me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Anonymous
Thanks for your description in details. And your problem is that the total value of a Calculated column isn’t changed according to the RLS. May I know whether you could provide a link of a sample pbix file containing your issue? Thanks in advance!
Best Regards,
Community Support Team _ Caiyun