Forum Discussion

rsbin's avatar
rsbin
Community Champion
6 years ago
Solved

Create Column as List of Values using M

Hello,

Am new to Power Query so looking for a guiding hand.

I have a table with Contract Start Date and  Contract End Date.  I have converted these dates to text values YYYYMM (but not sure if this was the right thing to do).

I have a Duration (months) that I have calculated.

Record No.  Duration  Start YearMonth  End YearMonth

129202003202011
2712202004202103
9715201910202012

 

I believe what I need next is to generate a Column with a list of values so for each Record ID I have the entire list of applicable YYYYMM values.  In the end, I am trying to calculate a monthly revenue stream for each contract no.

Any help or guidance would be very much appreciated.

Kind Regards,

  • Hi rsbin 

    you're nearly there!

     

    You have to make an adjustment in the red area:

     

    = Table.AddColumn(Source, "ListofDates", each Date.DatesBetween([Contract Start Date],[Contract Expiration Date],"Month"))

     

    That has to match the name of the query/function where you've posted my code. "." will not be allowed in query names, so it must be something else 🙂

     

     

7 Replies