The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
User | Count |
---|---|
77 | |
75 | |
36 | |
31 | |
29 |
User | Count |
---|---|
93 | |
81 | |
57 | |
48 | |
48 |