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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.