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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.