The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I'm trying to merge 3 measures into 1 single measure with a if-else clause. The individual measures display the selected category for 3 different variables and are defined like:
Selected Category 1 =
var selectedcat1 = SELECTEDVALUE('Table'[Category 1])
return "Category 1: "& IF(ISBLANK(selectedcat1), "All", selectedcat1)
I want 1 single measure which runs based on a if-else clause. For eg. if I select 'A' in category 1 and dont select anything in category-2 or category-3, it should display only 'Category 1:A' in the measure value.
The pbix file with data and measures is attached here: https://drive.google.com/file/d/1YmnTOG3NCUyO5bHuOZhBAMQm4Nw2BUwL/view?usp=sharing
selected =
var selectedcat1 = SELECTEDVALUE('Table'[Category 1])
var selectedcat2 = SELECTEDVALUE('Table'[Category 2])
var selectedcat3 = SELECTEDVALUE('Table'[Category 3])
return IF(ISBLANK(selectedcat1),BLANK()," Category 1: " & selectedcat1) &
IF(ISBLANK(selectedcat2),BLANK()," Category 2: " & selectedcat2) &
IF(ISBLANK(selectedcat3),BLANK()," Category 3: " & selectedcat3)
NOTE: When you select B, Y and Beta the results may look weird. This is caused by all three of your categories coming from the same table (and influencing each other). In your real world report you need to use separate tables for your slicers.
Thanks for the DAX formula, it's working as expected. I created 3 different tables for slicers as you suggested but I'm still getting a blank table when I select B,Y and Beta like previous scenario. Is there any way I can displacy a custom text (eg No data) using the same DAX formula when there's a blank table being returned.
Updated pbix: https://drive.google.com/file/d/1YmnTOG3NCUyO5bHuOZhBAMQm4Nw2BUwL/view?usp=sharing
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
33 | |
13 | |
12 | |
9 | |
8 |