Forum Discussion

philthomasp's avatar
philthomasp
New Member
6 years ago
Solved

IF statement issue

Hello, I'm new to Power Query, and I am working on a formula where I will create a Custom Column, and what I need the new column to provide is the following:   subtract 2 date columns and return t...
  • Thejeswar's avatar
    6 years ago

    Hi philthomasp ,

    The Issue could be because subtracting two dates would return a date and not a number to use with a relational operator <. So alternatively create a measure having DATEDIFF function in it as shown below

     

    Measure = IF(DATEDIFF(MAX(Table3[Drte2]),MAX(Table3[Dte1]),DAY) < 0, 0, DATEDIFF(MAX(Table3[Drte2]),MAX(Table3[Dte1]),DAY))

     

    Rgds,