Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Adding columns from different tables based on date

I have two tables, one contains a price column, and one contains a volume column. I'd like to create a new table with both price and column. There is a date column in each of the original tables that I'd like to be the relationship between the price and column. So in the end I want a table with Date, Price, and Volume. How can I do this? 

3 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi Anonymous ,

     

    You can take try of “Merge” option in query edit.

    Click “Merge Queries as New” to generate a new table under the condition of date matching:

     

    Alternatively, you can using DAX :

    Price = LOOKUPVALUE(Table1[Price],Table1[Date],Table2[Date])

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      So to be more specific, I'm in DAX and I've typed out a lot of summarized columns for a few different things, and I'm having trouble just simply adding a single column of values that correlate with the date. I was keeping it simple for explantions sake earlier, but now I can't seem to figure out how to add on that last column. Merge queries isn't an option at this point with the way the new table is set up. I think the Add Column tool will be the solution but I don't know how to get the prices to go right alongside everything else

      • v-frfei-msft's avatar
        v-frfei-msft
        Community Support

        Hi Anonymous ,

         

        Kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.