Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Power Query - full join or create combine list

Hi,

I have to list with generated values in Power Query:

"List.Numbers(0, 25)"

"List.Dates(#date(2019, 10, 27), 3, #duration(1, 0, 0, 0))"

 

and I want to full join it as in the pictures below.

Or maybe generate final list, where it will be to combine already.

 

Thank you

 

 

  • Please can you confirm why you wish to do this.  Most of the time, there is another method to achieve the same goal.

     

    To answer you question, you could pivot, then duplicate and unpivot... but the method is not ideal

     

    You could create a column column on the date table which generate your list of numbers, then all you would need to do is expand them (this would then create duplicates of your dates as required)

     

    Regards,

    Mathew

7 Replies

  • Please can you confirm why you wish to do this.  Most of the time, there is another method to achieve the same goal.

     

    To answer you question, you could pivot, then duplicate and unpivot... but the method is not ideal

     

    You could create a column column on the date table which generate your list of numbers, then all you would need to do is expand them (this would then create duplicates of your dates as required)

     

    Regards,

    Mathew

    • Anonymous's avatar
      Anonymous
      Not applicable

      I am not against another method. I welcome better way than mine.

      I choose this method because It seemed to be the simplest method for me, but I don't have much experience with Power Query. 

       

      My goal:

      I have a users who give me a date range, date_from and date_to. I have to create table with each date from this range in first column and with numbers from 0 to 24 in second column for each date (for example from 27.10.2019 to 29.10.2019)

      Next I need to left join data from ODataFeed to my created table above.

      And next I need to create pivot table from these joining data. In row with dates and in columns with numbers from 0 to 24.

       

      This is my goal. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Seems like you need a crossjoin.

     

    Create a dummy column in each of the tables. Give the same value to all the rows of the dummy column in both tables (e.g.: "1"). Inner joinjoin tables on the dummy columns. Voila: you have the Cartesian product of the tables.