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.
Hello, I have a table like this
Key A B
1 Fail OK
2 OK NA
I want to have a barchart with A and B in x axis (so 2 bars), and the distribution of Fail, OK and NA as value (Fail, OK, NA as legend), y axis = Number of key
Do you know how to do this ? I want to use only DAX measure, not calculated table
Maybe calculated column if possible
But don't want to make unpivot with Query, i don't want to change my table
Thank you in advance
Solved! Go to Solution.
You can simulate unpivoting with DAX by using SELECTCOLUMNS and UNION. For more details, you can check this explanation (https://community.fabric.microsoft.com/t5/Desktop/Unpivot-columns-using-dax/td-p/1350856).
However, I recommend using Power Query instead. I don't see any reason not to use it, but if you have specific reasons for avoiding it, please let me know.
By the way, I don't think you can achieve this without using a calculated table.
Hello,
I think you need to unpivot your A and B columns, like this:
Key | Type | Value |
1 | A | Fail |
1 | B | OK |
2 | A | OK |
2 | B | NA |
5 | A | Fail |
5 | B | OK |
Then you just need to put those in the bar chart
if key is a number like this:
Please if it solved your issue mark as accepted solution
Yeah but how with DAX ? i want to avoid Power query
You can simulate unpivoting with DAX by using SELECTCOLUMNS and UNION. For more details, you can check this explanation (https://community.fabric.microsoft.com/t5/Desktop/Unpivot-columns-using-dax/td-p/1350856).
However, I recommend using Power Query instead. I don't see any reason not to use it, but if you have specific reasons for avoiding it, please let me know.
By the way, I don't think you can achieve this without using a calculated table.