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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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

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


View solution in original post

@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


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)

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


@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


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


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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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