Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi.
Simple question, I want to return a count number of row or a hard coded value based on slicer selection.
See example table below.
If user select Region = Central, expected return value = 3... more like nested if/else or switch. This return value will then be use in a calculation for a average, hope this I'm making sense.
How would I able to achieve this? Thanks you all for your help.
I'm imagining a measure of the following...
Measure =
If Region Slicer = Central return count sites value = 3
else if
Region Slicer = North return count sites value = 3
else if Region Slicer = North East return count sites value = 4
else if Region Slicer = North West return count sites value = 3
else if Region Slicer = South return count sites value 4
else return count sites value 17
Data table:
| Site | Region |
| Site 1 | Central |
| Site 2 | Central |
| Site 3 | Central |
| Site 1 | North |
| Site 2 | North |
| Site 3 | North |
| Site 1 | North West |
| Site 2 | North West |
| Site 3 | North West |
| Site 1 | South |
| Site 2 | South |
| Site 3 | South |
| Site 4 | South |
| Site 1 | North East |
| Site 2 | North East |
| Site 3 | North East |
| Site 4 | North East |
Expected Solution:
| Selected Region | # of Site/Row |
| Central | 3 |
| North | 3 |
| North West | 3 |
| South | 4 |
| North East | 4 |
You can add both columns to your table then set the sites to "Count". See screenshot for reference:
Thanks @Syk, understood. But what I'm seeking is returning that value to be use in a calculation.
Something along the line of this....
If Region Slicer = Central return count sites value = 3
else if
Region Slicer = North return count sites value = 3
else if Region Slicer = North East return count sites value = 4
else if Region Slicer = North West return count sites value = 3
else if Region Slicer = South return count sites value 4
else return count sites value 17