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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
mai_2020
Frequent Visitor

Combining columns from different tables with DAX

Hi everybody,

 

I am not sure if this is possible, but i have a Dates table, Actuals and Forecasts. Within actuals and forecast table i have some master data(like id). Actuals and forecasts are not connected among each other, only via dates table. 

What i want to create is a table with columns like that:
Date, ID, Sales, Quantities, Few other measures

Where if there is no data for those dates from the actuals, i want to replace columns ID, Sales, Quantities etc by Forecast data.

2 ACCEPTED SOLUTIONS
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @mai_2020 ,

 

all filtering/categorizing columns must be linked in both tables via a common (Dimensions) table.
I think in this case the ID column will be the problem.
Can you merge the two tables into one table?

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

mwegener
Most Valuable Professional
Most Valuable Professional

@mai_2020 if possible, I would recommend you to solve it with PowerQuery.
This is the more efficient solution.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@mai_2020 Just to understand the problem, so check the date in the actual table, if found get from the actual, if not found check the data for that date in the forecast and get it from the forecast table. Is this what you are looking for? 

 

First, need to understand the requirements, PQ is although going to be the right approach as suggested by @mwegener  but you also mentioned some measures, so DAX might be the way to go

 

I would recommend to put some sample data and expected output to provide you the solution.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

mai_2020
Frequent Visitor

@mwegener I do have a master data table which is not linked to dates table in any way. I was hoping that i could do it beautifully with calculated table, where all the possible id's will be assigned to a date. Sort of like

1/1/2021, id1, sales (from sales)
1/1/2021, id2, sales (from sales)

1/1/2021, id5, sales (from forecast)

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @mai_2020,

 

in your sample data it looks like date and id are the key columns for the condition.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


mwegener
Most Valuable Professional
Most Valuable Professional

@mai_2020 if possible, I would recommend you to solve it with PowerQuery.
This is the more efficient solution.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


mwegener
Most Valuable Professional
Most Valuable Professional

Hi @mai_2020 ,

 

all filtering/categorizing columns must be linked in both tables via a common (Dimensions) table.
I think in this case the ID column will be the problem.
Can you merge the two tables into one table?

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


This turned out to be the most practical solution for me:)

Helpful resources

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

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.