Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Checking and transforming end date in power query

Hi 

I have 2 columns start date and end date where i have end dates lesser than start dates. If my end date is before start date I want to replace end date with start date value, thereby the difference between start and end dates = 0. I found creating measure using DateDiff in power bi for this purpose but I want to clean this in power query. How to do it.? 

I was unable to give column values in Replace option under end_date column. It is accepting only distinct values present in the data.

  • Anonymous Create a new column (Add Column)

    = if [end date] < [start date] then [start date] else [end date]

     

    Then remove your end date column and rename the new column to end date.

2 Replies

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

    Anonymous Create a new column (Add Column)

    = if [end date] < [start date] then [start date] else [end date]

     

    Then remove your end date column and rename the new column to end date.