+ Reply to Thread
Results 1 to 3 of 3

IF Formula in Power Query

  1. #1
    Forum Contributor
    Join Date
    11-01-2016
    Location
    Prague
    MS-Off Ver
    2013
    Posts
    121

    IF Formula in Power Query

    Hi Everyone,

    I have a complex IF formulas in Power Query (complex for me)

    I have 4 columns >> Date1 - Date2 - Date3 - Date4

    If Date3 is equal to certain exact date, I want to take Date4 without any question. But if not, then I want to go and check Date1 and Date2. There the condition is, if Date1 is null then take Date2. Else take Date1.

    Should I use AND or something else?

    if ([Date3] = "1/1/1111" then
    Date.AddYears([Date4],+1)
    else if ([Date1] = null then Date.AddYears([Date2],+1)
    else Date.AddYears([Date1],+1)


    When I used above formula, its taking Date2, although Date3 = 1/1/1111

    PS: in example Date1 = null

    Thanks
    Orhan
    Last edited by orhanceliloglu; 05-03-2018 at 04:56 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IF Formula in Power Query

    Orhan

    If Date3 has actual date values in it then I don't think comparing it to the string '1/1/1111' is going to work.

    Is '1/1/1111' definitely the 'date' you want to check Date3 for?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: IF Formula in Power Query

    Give us a sample of your data, with your expected outcome.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 02-16-2018, 06:50 AM
  2. Replies: 8
    Last Post: 09-22-2017, 05:41 AM
  3. Excel formula bar to display the result of the formula , not the formula?
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2016, 07:15 PM
  4. Replies: 11
    Last Post: 06-06-2014, 03:34 PM
  5. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1