Forum Discussion

wi11iamr's avatar
wi11iamr
Advocate II
10 years ago
Solved

How to compare date when adding custom column

I'm trying to create a Custom Column for the Financial Year of a company.   The below extract is just trying to test how I can compare two dates within my query editor. = Table.AddColumn(#"Changed...
  • wi11iamr's avatar
    10 years ago

    Ha - I don;t know why I didn't think of this sooner!! :)

     

    Instead of creating a Custom Column, I tried using the "Conditional Column".

    After entering the necessary values it managed to create my FinancialYear column, and I could then see the actual code in the query editor, as follows:

     

    = Table.AddColumn(#"Changed Type6", "FinancialYear", each if [DateCaseCreated] <= #datetime(2016, 6, 30, 0, 0, 0) then "FY2016" else "FY2015" )

     

    Woohoo!!! :)