Forum Discussion

krahul57's avatar
krahul57
New Member
4 years ago
Solved

How to merge two date columns into one

Hi Community,

I have two date columns startdate and enddate. 

I want to combine these columns to have one date column to calculate startofmonth etc. calculations. 

I tried combining these using power query but its showing incorrect data in report when I apply date filter using the new date column created.

I have null values as well in my date columns.

Can anybody help.

Thanks,
R



10 Replies

    • krahul57's avatar
      krahul57
      New Member

      I mean i want to get all dates from start date and end date into one column.

      • tamerj1's avatar
        tamerj1
        Icon for Community Champion rankCommunity Champion

        krahul57 
        Here is an example of how to do that by creating a new calculated table usinng GENERATE function. Please note that blanks can create errors iff exist. Usualy if the end date is blank we return TODAY like:
        CALENDAR ( Data[Start Date] , COALESCE ( Data[End Date] ), TODAY ( ) ) ). If the start date is blank then you need to decide which date shall be returned (probably the min date available in data).

        Orders New = 
        SELECTCOLUMNS (
            GENERATE (
                Orders,
                CALENDAR ( Orders[Start Date], Orders[End Date] )
            ),
            "Order Number", [Order Number],
            "Date", [Date]
        )