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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ryan_b_fiting
Post Patron
Post Patron

Row Level Security - Allows aggregated data to be seen

Hello Community - 

I have a rather complex problem I think.  So I am setting up my RLS for my reporting that is being rolled out to multiple practices and multiple teams.  Some of the metrics we track Ranks among peers in your practice, Top ranked provider metrics (no names provided, just the metric) so the providers can see how they are tracking in terms of rank and versus the Top dogs numbers.

 

My question comes in here.  Is there a way to keep my dynamic RLS using the UPNs, but still allow the rankings, the Top Provider metrics and the overall average of the practice for the specific metrics?

 

Currently, when I test it out, my provider rank is always 1 out of 1, the Top metric is my metric and the average value is my value.

 

Any help on this would be greatly appeciated.  I am trying to roll this out in the next 2 weeks and am having a hard time figuring out a solution to this.

 

Thanks in advance for any help!

Ryan F.

1 ACCEPTED SOLUTION

Sorry, you are right. It's because of "lineage".

 

Don't create relationships here, but in your Measure for NPE for example do this:

 

AggregateNPENoRLS = 
    CALCULATE(
        SUM(Aggregate_[NPEs]),
        TREATAS(VALUES(Date_Table[Date]), Aggregate_[Date]),
        TREATAS(VALUES(Provider_Table[Provider Name], Aggregate_[Provider Name])
    )

 

(you can also use AVG(Aggregate_[NPEs]) - I think that would make more sense in this case.

 

TREATAS transfers the filter to the Aggregate_ Table without having to use a relationship. (thats becase of lineage - if you want to learn more about it, see Understanding data lineage in DAX - SQLBI)

 

BR

 

View solution in original post

10 REPLIES 10
lukiz84
Memorable Member
Memorable Member

Hi, it's not that complex.

 

Easiest way is to create a calculated table with those aggregated data and don't put any RLS on it.

Then you just need to create relationships to your dimension table and create some measures on this table.

 

BR

Won't those measures automatically be filtered by the RLS prior to the table being calculated?

 

Nope, calculated tables are calculated when refreshing the data model. And the data model (when refreshing) doesn't know which user connects to the report, hence no RLS on it 😉

 

BR

I tried it and unfortunately that does not work.  Would you suggest using CALCULATETABLE() or SUMMARIZE() function to create your table?  I cannot get the CALCULATETABLE() to work, but the SUMMARIZE() is way off.

 

My rankings are created in tabular editor as well because we are ranking 40+ metrics.  But I do not think that should matter because we can just select what Calc Item we are looking at.

 

Do you have a sample of a table you would cacluate to do this?  

CALCULATETABLE is not / can't be used to create a calculated table.

 

I can share a sample from my own tabular model:

 

SUMMARIZECOLUMNS(
        'DimTable'[DimensionXY],
        'DimTable'[DimensionYZ],
        'Dates'[Date],
        "RevenueActual", [RevenueActual],
        "CostsActual", [CostsActual],
        "RevenueBudget", [RevenueBudget],
        "CostsBudget", [CostsBudget]
)

 

Thanks for the information.  I think there is too many limitations with this, but I may just not completely understand the solution.

So if I were to use this, when I am looking at a specific date range, this aggregated table will not show the proper data within that range correct?  Same with looking at specific practices because we cannot make the joins there.  So the rankings and Top Provider numbers will not be displaying correct.

 

Is that a correct assessment, or am I not understanding properly?

Thanks again for your input.

Thanks for the information.  I think there is too many limitations with this, but I may just not completely understand the solution.

 

> No limitations, you just have to make the correct relations 🙂 (EDIT: No relationship, Transfer the filter via TREATAS)

 

So if I were to use this, when I am looking at a specific date range, this aggregated table will not show the proper data within that range correct?  Same with looking at specific practices because we cannot make the joins there.  So the rankings and Top Provider numbers will not be displaying correct.

 

> For the date range: Sure, that's why I included the date in SUMMARIZECOLUMNS, you can just connect your Date-Table to this field after creating the calculated table. Then everything is filtered according to your date (range) selection 🙂 (EDIT: No relationship, Transfer the filter via TREATAS) 

 

> For specific practices: Sure, just add your key column from the "Practices" Table (i assume it's called like that) in SUMMARIZECOLUMNS, then you can connect your key to this field afterwards and filter it accordingly. (EDIT: No relationship, Transfer the filter via TREATAS) 

 

I think you get the point now 🙂

 

Is that a correct assessment, or am I not understanding properly?

 

> Not correct 😉

 

Thanks again for your input.

 

> You are very welcome, I also was stuck at those points a while ago 🙂

You cannot join the tables though because it will create a circular dependency right.

Circ_Dep.PNG

Sorry, you are right. It's because of "lineage".

 

Don't create relationships here, but in your Measure for NPE for example do this:

 

AggregateNPENoRLS = 
    CALCULATE(
        SUM(Aggregate_[NPEs]),
        TREATAS(VALUES(Date_Table[Date]), Aggregate_[Date]),
        TREATAS(VALUES(Provider_Table[Provider Name], Aggregate_[Provider Name])
    )

 

(you can also use AVG(Aggregate_[NPEs]) - I think that would make more sense in this case.

 

TREATAS transfers the filter to the Aggregate_ Table without having to use a relationship. (thats becase of lineage - if you want to learn more about it, see Understanding data lineage in DAX - SQLBI)

 

BR

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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