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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mmmm
Frequent Visitor

Understanding of Countrows function within calculate in security implementation and ranking

Hi,

I have just seen the security implementation on SSAS tabular Project which is my existing project. There are 2 main tables for implementing Security.

  • DimUserPermission which has Username Column and  1 other Column lets say Country. So there are 2 Columns(Username, Country). 
  • DimSecurity also has 2 columns Security id incremental Column and Country.

Fact table also have Security id

 

On SSMS tabular Instance under the role, there is a tab Row Filter.

there is 2 Dax Query. On Table DimUserPermission:-

DimUserPermission[UserName] = UserName()

On Table DimSecurity:-

Calculate
   (
   countrows(DimUserPermition ),
   DimUserPermission[UserName]=UserName()
   )>=1

I would like to know what is the result of this Query 

 

Calculate ( countrows(DimUserPermition ), DimUserPermission[UserName]=UserName() )>=1

 

If it is only used to validate the result, Then How the filters are passed in fact table. Because DimUserPermission has 1 to many relationships with Dimsecurity. Dimsecurity is 1 too many relationships with fact.

almost the same problem for the Code mention in the screenshot. 

 

Advanced_Ranking.png

 

the above code in the screenshot is Dynamic Grouping With Additional Ranking Logic. In this Logic, CountRows function only validates the result. How the Countrows function returns rows to filter function.

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @mmmm ,

 

Have your tried add RELATEDTABLE  function before Customer Group in the filter.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi, 

Everything is working. As I mentioned in my Question above there is 2 logic both are work Correctly.
I have the problem to understand how it works. There are 2 parts of logic in which I have confusion.

 

1.in the security implementation part how the data is passed from DimSecurity Table to fact table because the below Code only validate gives true and false.

the code 

Calculate
   (
   countrows(DimUserPermition ),
   DimUserPermission[UserName]=UserName()
   )>=1

 2. Same problem in ranking How Countrows function delivers the filter rows for filter Function.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.