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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
seamie82
Frequent Visitor

Best approach to combining data with some matching rows and different columns

Hi, 

What is the best approach to combining data from two tables (Actuals and Forecast in the example below), so both the Actual and Forecast field are available in the resulting table when some rows match and some don't.

seamie82_1-1664448583110.png

Merging using a full outer join results in the following:

seamie82_0-1664448546228.png

Would you then just create a new name field something like this:  

seamie82_2-1664449172757.png

Taking the value from Name if it's not null or from Forecasts.Name if Name is null.

Resulting in this:

seamie82_3-1664449264919.png

Which can obviosuly then be tidied up:

seamie82_4-1664449331563.png

Is there a better way of achieving the same thing?

 

3 REPLIES 3
AntonioM
Solution Sage
Solution Sage

Hi @seamie82 ,

 

The way I would approach this is to unpivot both the Actual and Forecast columns, append the two tables together and then rename 'Attribute' to Type.

 

AntonioM_1-1664452280701.png

AntonioM_2-1664452288526.png

 

That would give you this table:

 

AntonioM_0-1664452256016.png

 

Then in your measures you can use

CALCULATE ( [measure] , Table[Type] = "Actual" )

or

CALCULATE ( [measure] , Table[Type] = "Forecast" )

to use the two different sets of values.

 

 

amitchandak
Super User
Super User

@seamie82 ,  Power query append.

Append : https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

Or common tables https://amitchandak.medium.com/power-bi-when-i-asked-you-to-create-common-tables-a-quick-dax-solutio...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks, I read this already: https://radacad.com/append-vs-merge-in-power-bi-and-power-query

If you used append though would you do something like this?

Adding a descriptive column to each source and then appending:

seamie82_0-1664452620435.png

 

 

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors