Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Combine two plots with R/ combine two variables on one x axis

Dear all, 

 

I have a table like this (document table) in Power BI:

Dokument No | ProjectLeaderID | Service-EmployeeID | ProjectDesignerID | CommissionProjectLeader | CommissionProjectDesigner

 

And a second table (employee table):

EmployeeName | EmployeeID | CostCenter

 

So in my data model, I tripled the employee table and connected the EmployeeID to the IDs in the document table (in bold). so now I can make a chart e.g. with EmloyeeName & Comission ProjectLeader and so on -> basic and easy so far!

BUT: the service employee has normally its own comission. However the service employee can also in certain cases be the ProjectLeader and/or the Project Designer (e.g. Georg, Fred and Jane are service employees. but in one project Georg is the ProjectLeader and Fred the service employee, in another one Jane is the Service employee and Georg the ProjectDesigner.

So I now created two charts side to side: one for the ProjectLeader & their Comission and one for the ProjectDesigner and their comission and added a filter on both charts with the ServiceEmployee CostCenter. So in my example Georg is in both tabels with a certain comission.

 

My question now: is it possible to combine these charts into one? so that Georg has only one bar (summarized comission) or at least two bars (for each comission)? I just need to combine my two x values to one...

I wanted to try with R, but I don't knwo how to combine two plots there and didn't find sth easy in the web..

My code for the ProjectLeaderComission:

library(ggplot2)
ggplot(dataset, aes(x = EmployeeName, y = ComissionProjectLeader)) + geom_bar(width = 0.85, stat = "identity")
 
Or sth else better than R?
Thanks in advance!
 
Best regards
Eileen

 

 

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Do [CommissionProjectLeader] and [CommissionProjectDesigner] show "Yes" or "No"?  I think you can try to combine these two columns as one, rename it as [Type] with data "ProjectLeader" and "ProjectDesigner".

As far as I know, you can try to add a legend in R Plot.

For reference: Add a basic Legend in a custom visual

Or you can create two meausres to calcualte the sales for "ProjectLeader" and "ProjectDesigner". And add measures into Value Field of the visual.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi RcoZhou,

 

no they have values in EUR (the comission amount)...

Thanks 🙂

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.