Forum Discussion
Combining 2 Companies from Same Column
Good Day!
I'm have a stacked bar chart visual with a list of companies and company locations in a table with Techs and Laborer's for each. (see below) I would like to write a measure that combines 2 of the companie's Techs and Laborers into 1 bar on the chart. (PMOL and Shelby's Mustard) so that they appear on the bar chart as one value that I can name PMOL.
I"m not sure if a measure is the correct method to accomplish this, so I am open to anything.
Hi Gasdetect40
you can create a new columndax formula ->
Company Group = SWITCH(TRUE(),Company_Labor_Tech_Data[Company] = "PMOL", "PMOL",Company_Labor_Tech_Data[Company] = "Shelby's Mustard", "PMOL",Company_Labor_Tech_Data[Company] = "Ed Frank", "Ed Frank")
and use stacked bar chart to get this output
If it helps please give Kudos and Accept it as solution , which will help other members in futureHi Gasdetect40 ,
Thanks for reaching out to the Microsoft fabric community forum.
Create a Merged Company ColumnMerged Company =
SWITCH(
TRUE(),
'Table'[Company] IN {"PMOL", "Shelby's Mustard"}, "PMOL",
'Table'[Company]
)Unpivot the Techs and Laborer Columns
In the query editor:
Select the columns “# of Techs” and “# of Laborer”.
Right-click one of them and choose “Unpivot Columns”.
Click “Close & Apply” to return to the main Power BI interface.
Create the Stacked Bar Chart
Set the following fields:
X-axis : Value
Y-axis : Merged Company
Legend : Attribute
Please find the below attached .pbix file for your reference.If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it
Best Regards,
Sreeteja.
Community Support Team
7 Replies
- Greg_DecklerCommunity Champion
Gasdetect40 Yes, a measure is the way to go most likely. Simple FILTER statement with a SUMX for example.
- elitesmitpatelSolution Supplier
Hi Gasdetect40
you can create a new columndax formula ->
Company Group = SWITCH(TRUE(),Company_Labor_Tech_Data[Company] = "PMOL", "PMOL",Company_Labor_Tech_Data[Company] = "Shelby's Mustard", "PMOL",Company_Labor_Tech_Data[Company] = "Ed Frank", "Ed Frank")
and use stacked bar chart to get this output
If it helps please give Kudos and Accept it as solution , which will help other members in future - SundarRajSuper User
Hi Gasdetect40,
You can do this on Power Query by using the Table.Group function. Thanks. This is the output: - v-sshirivoluCommunity Support
Hi Gasdetect40 ,
Thanks for reaching out to the Microsoft fabric community forum.
Create a Merged Company ColumnMerged Company =
SWITCH(
TRUE(),
'Table'[Company] IN {"PMOL", "Shelby's Mustard"}, "PMOL",
'Table'[Company]
)Unpivot the Techs and Laborer Columns
In the query editor:
Select the columns “# of Techs” and “# of Laborer”.
Right-click one of them and choose “Unpivot Columns”.
Click “Close & Apply” to return to the main Power BI interface.
Create the Stacked Bar Chart
Set the following fields:
X-axis : Value
Y-axis : Merged Company
Legend : Attribute
Please find the below attached .pbix file for your reference.If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it
Best Regards,
Sreeteja.
Community Support Team- v-sshirivoluCommunity Support
Hi Gasdetect40 ,
I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.
Thank you.
- v-sshirivoluCommunity Support
Hi Gasdetect40 ,
Just wanted to check if you had the opportunity to review the suggestion provided? If so, please mark the helpful reply and Accept it as the solution . This will be helpful for other community members who have similar problems to solve it faster.