+ Reply to Thread
Results 1 to 8 of 8

Days function in Power Query

  1. #1
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Days function in Power Query

    Hi all,

    Is there a way i can create fuction like below in Power Query please.

    =IF(DAYS360([@[Posting start date]],[@[Posting End date]])<0,"",DAYS360([@[Posting start date]],[@[Posting End date]]))

    for example i encloased a file and the output i needed it is in the column "S".

    Thanks & regards,
    Hudson.
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,447

    Re: Days function in Power Query

    Hi Hudson,

    Why can't you use the Date.Month() function times 30 and then add or subtract the day difference?
    https://docs.microsoft.com/en-us/pow...y-m/date-month
    I think also you need to make all those day "31" back to "30".
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Days function in Power Query

    Hi Marvin,

    Thanks for looking into my query, is there a way i can also remove Negative values , for example if my start date is bigger than my end date sometimes i get to see the -Negv values. do you want to also advice in that please.

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,223

    Re: Days function in Power Query

    Please try

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Days function in Power Query

    Hi ,

    This worked like a charm and thanks for taking a look at it .

    May i ask some tweeks in here please , is there a way i can Handle errors , if eithers of the dates are null it is showing Error in my output .. can we fix this ?

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,223

    Re: Days function in Power Query

    Maybe


    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Days function in Power Query

    Thanks Mate . all good now

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,921

    Re: Days function in Power Query

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. [SOLVED] Power Query; help with left function
    By Reykjavik in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-29-2020, 11:02 AM
  2. [SOLVED] Power Query - excel formula translation into Power Query
    By afgi in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 02-19-2020, 03:38 AM
  3. Replies: 4
    Last Post: 02-17-2020, 06:03 AM
  4. [SOLVED] Power Query NETWORKDAYS function
    By kersplash in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 12-13-2019, 06:42 PM
  5. [SOLVED] Power Query - Converting a query into a function
    By kersplash in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-29-2019, 12:17 AM
  6. [SOLVED] Countifs function in Power Query?
    By slc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-23-2019, 08:20 AM
  7. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 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