Forum Discussion

mai_2020's avatar
mai_2020
Frequent Visitor
5 years ago
Solved

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.

  • 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?

     

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

     

6 Replies

  • mwegener's avatar
    mwegener
    Icon for Most Valuable Professional rankMost 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?

     

    • mai_2020's avatar
      mai_2020
      Frequent Visitor

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

  • mai_2020's avatar
    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's avatar
      mwegener
      Icon for Most Valuable Professional rankMost Valuable Professional

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

       

    • mwegener's avatar
      mwegener
      Icon for Most Valuable Professional rankMost Valuable Professional

      Hi mai_2020,

       

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

       

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