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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
JohnD2
Frequent Visitor

combining data of two tables into one graph

Hi I like to combine two tables of data into one bar chart.

 

this this the first data table:

Forecast data AmountExpecteddateDateofForecast Product 
  801-6-201627-4-2016 Red 
  901-6-20164-5-2016 Red 
  951-6-201611-5-2016 Red 
  981-6-201618-5-2016 Red 
  1001-6-201625-5-2016 Red 
  905-6-20161-5-2016 Green 
  955-6-20168-5-2016 Green 
  1005-6-201615-5-2016 Green 
  1085-6-201622-5-2016 Green 
  1105-6-201629-5-2016 Green 

 

This is the second datatable.

  AmountExpecteddateDateofForecast Product 
actuals data 1011-6-20161-6-2016 Red 
  1125-6-20165-6-2016 Green 

 

 

 

The bar chart could look like this

 

barchart-forecast-actuals.PNG

 

The bars should be clustered by expecteddate and product

 

The last bar of the product (= actuals) may be different color.

 

I like to have this analysis over a month period for example.

 

Any ideaS how to do this?

 

JohnD2

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi sridevi,


In your scenario, you should combine the two tables into a single one first.

uniontable = UNION(ADDCOLUMNS(Actual,"Actuals","actual forecast"),ADDCOLUMNS(Forcecast,"Actuals","Forcecast forecast"))


To distinguish the bar color between actual value and forcecast value, you can add anextra legend in the chart.

aa.PNG


If you have any question, please feel free to ask.


Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi sridevi,


In your scenario, you should combine the two tables into a single one first.

uniontable = UNION(ADDCOLUMNS(Actual,"Actuals","actual forecast"),ADDCOLUMNS(Forcecast,"Actuals","Forcecast forecast"))


To distinguish the bar color between actual value and forcecast value, you can add anextra legend in the chart.

aa.PNG


If you have any question, please feel free to ask.


Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BhaveshPatel
Community Champion
Community Champion

Hi John,

 

Please see attached file here for your solution.

You have to append your Actuals Table onto the Forecast Table and You can load this query into the PowerBI and Create Bar Chart visual with data labels on to visualize your output.

 

Thanks & Regards,

Bhavesh

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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