Forum Discussion
How to make a clustered column chart with multiple fields
- Anonymous1 year ago
Thanks for the reply from MockIT2As and Fowmy , please allow me to provide another insight:
Hi, data4good
Thanks for reaching out to the Microsoft fabric community forum.First I have created the following table and the column names and data are the data you have given:
Here are the detailed steps for your reference, which I hope will help you proceed more clearly:
1.Firstly, copy the query.In Power Query, right-click the original query and select "Duplicate.
This preserves the original data, avoiding risks associated with direct modifications.
2.Secondly, Unpivot operation:Select all columns except the "Employee" column and choose "Unpivot Columns."
This converts the data from a wide table to a long table format, making it easier to analyze.
3,Next, create a bar chart.In Power BI Desktop, select the bar chart visualization.
Drag the "Attribute" field to the X-axis.
4.Then, modify visualization settings:
Change bar chart colors.Create a new measure to define colors for different categories.
ColorCode = SWITCH ( MAX ( 'Table (2)'[Attribute] ), "Basic Needs", "#FF5733", "Diapers", "#33FF57", "Childcare", "#3357FF", "Food", "#FF33A6", "Clothing", "#FFC300", "#FFFFFF" )Modify visualization title.In the "Format" tab, find "Title" and enter the new title text.
Add column titles.In the "Format" tab, find "Data Labels," enable them, and set the label format.
Remove the title from the x and y axes.
5.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 1 year ago
Ah thank you so much! Your response made me realize the step I was missing, and it was actually even simpler than what you laid out. I actually already had a table of data in long format, and I had used calculated columns to create a series of boolean columns. Following your logic, I was able to create an additional calculated column that combined all the boolean columns. Thank you!!
- You can do a variable data form next to the graph, and extract the results onto the bar graph and the x and y axis labeled with the title from the chart. Since only 2 resulting you would need to show how you got the results onto the bar chart by doing a results table.
- I hope this helps.