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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
chrisw14
New Member

Number of rows with row-level security filter

Hi,

I would like to ask for your help for the following simplified scenario:

There is a table CITIES and a table COUNTRIES and I want to show the cities or countries in a map if the user has access rights (based on row-level security filter) for these cities / countries.

The map should represent cities if the current user has access to less than 5 cities. Otherwise the map should show the countries.

Therefore I tried the following measures but unfortunately the number of rows is always wrong:

 

CountryOrCity1 = If([CountRows(CITIES)] > 5; CALCULATE(MAX(COUNTRIES[COUNTRY_NAME])); CALCULATE(MAX(CITIES[CITY_NAME])))

CountryOrCity2 = If([CountRows(ALL(CITIES))] > 5; CALCULATE(MAX(COUNTRIES[COUNTRY_NAME])); CALCULATE(MAX(CITIES[CITY_NAME])))
CountryOrCity3 = CALCULATE(If([CountRows(CITIES)] > 5; MAX(COUNTRIES[COUNTRY_NAME]); MAX(CITIES[CITY_NAME])))

CountryOrCity4 = CALCULATE(If([CountRows(ALL(CITIES))] > 5; MAX(COUNTRIES[COUNTRY_NAME]); MAX(CITIES[CITY_NAME])))

 

Can you please tell me how the number of rows is calculated in the right way?

 Thank you in advance.

1 REPLY 1
chrisw14
New Member

Does anyone have an idea for this problem? Thank you.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.