Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 19 | |
| 12 | |
| 10 |