+ Reply to Thread
Results 1 to 10 of 10

PowerPivot dynamic date calculation

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Question PowerPivot dynamic date calculation

    Hi all,

    I'm trying to get into PowerPivot and the DAX formulas. So far I'm doing ok, but I can't figure out how to deal with dates properly.

    So, for one explicit calculation I'm using
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and this is giving me my 50 open orders out of 200 total. When I add this to a PivotTable with Product name in the rows and the calculated field in the Values it works just fine, showing me only the 50 rows.

    Although, to the above, I want to add a date field for current year.
    If I use
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    it works just fine, but I would like to have something like "current year" instead of text 2018 so this could be dynamic and I don't need to amend all this next year...

    The closest I got was
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    With this the calculation gives the same result (50) but when added to the pivot all the 200 entries are displayed.

    Is there any date formula that can actually "filter" the dates when added to a pivot?

    Thank you!

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: PowerPivot dynamic date calculation

    YEAR(TODAY()) instead of "2018"

    like that?
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  3. #3
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: PowerPivot dynamic date calculation

    Quote Originally Posted by ben_hensel View Post
    YEAR(TODAY()) instead of "2018"

    like that?
    Hi Ben,

    Thank you.
    Like this?
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This gives a (blank) result

    Using the date break down column with
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    it just gives an error.
    Last edited by no_Fate; 01-26-2018 at 08:13 PM.

  4. #4
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: PowerPivot dynamic date calculation

    Shouldn't that last term be in CALCULATE() be:

    Please Login or Register  to view this content.

    EDIT:
    Wait looks like you tried that too.

    Well, since
    "2018" <> 2018
    (because even if their value is the same, a text string "2018" is not considered the same thing as the number 2018, so they are not the same when compared in a Boolean),

    maybe try:
    Please Login or Register  to view this content.
    Last edited by ben_hensel; 01-26-2018 at 08:18 PM.

  5. #5
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: PowerPivot dynamic date calculation

    Quote Originally Posted by ben_hensel View Post
    Shouldn't that last term be in CALCULATE() be:

    Please Login or Register  to view this content.

    EDIT:
    Wait looks like you tried that too.

    Well, since
    "2018" <> 2018
    (because even if their value is the same, a text string "2018" is not considered the same thing as the number 2018, so they are not the same when compared in a Boolean),

    maybe try:
    TEXT(YEAR(TODAY), "#")
    Hi Ben

    Using the date break down column with
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    it just gives an error

  6. #6
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: PowerPivot dynamic date calculation

    Quote Originally Posted by ben_hensel View Post
    Shouldn't that last term be in CALCULATE() be:

    Please Login or Register  to view this content.

    EDIT:
    Wait looks like you tried that too.

    Well, since
    "2018" <> 2018
    (because even if their value is the same, a text string "2018" is not considered the same thing as the number 2018, so they are not the same when compared in a Boolean),

    maybe try:
    Please Login or Register  to view this content.
    I'm afraid TEXT is not accepted in DAX. It's not recognized as valid.

  7. #7
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: PowerPivot dynamic date calculation

    Guh maybe forcing it into a text string with a stupid concatenation then:

    Please Login or Register  to view this content.

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: PowerPivot dynamic date calculation

    just thought

    did you try :
    Tracker[received date (Year)]=2018

  9. #9
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: PowerPivot dynamic date calculation

    Hey! Don't know how it works, but it does!

    Thank you for your expertise and time. Cheers!

  10. #10
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: PowerPivot dynamic date calculation

    Quote Originally Posted by ben_hensel View Post
    Guh maybe forcing it into a text string with a stupid concatenation then:

    Please Login or Register  to view this content.
    Hey! Don't know how it works, but it does!

    Thank you for your expertise and time. Cheers!

+ 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. Powerpivot calculation based on multiple input fields
    By TripitakaBC in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-03-2017, 12:36 PM
  2. Dynamic Filters for PowerPivot Sourced Pivot Tables
    By nnazarian in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2015, 02:06 PM
  3. [SOLVED] PowerPivot Percentage Calculation
    By dingdongsilver in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-30-2014, 10:03 AM
  4. Dynamic Year to Date Calculation
    By pbexcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2014, 05:07 AM
  5. Replies: 2
    Last Post: 06-02-2014, 09:34 AM
  6. Help with Dynamic Grouping to Subtotalling fields in PowerPivot Table
    By mikeTRON in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-12-2013, 01:10 PM
  7. PowerPivot Calculation
    By cdw1982 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-22-2011, 01:34 PM

Tags for this Thread

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