+ Reply to Thread
Results 1 to 5 of 5

Trying to compare two dates cant figure out what im doing wrong.

  1. #1
    Registered User
    Join Date
    03-05-2011
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    84

    Trying to compare two dates cant figure out what im doing wrong.

    I'm using Power Query to generate the attached table which I load into a data set to build charts in PowerBI.

    I cant seem to figure out the best way to compare day over day revenue for each source. Very new to DAX and just getting my feet wet in PQ. If i could do this in power query that would be even better.

    I added columns of what i think I should be trying to get

    Again i know nothing about DAX but I tried this formula and got blanks.
    =CALCULATE(Table[Sum of Revenue],PREVIOUSDAY(Table[Date]))

    My guess is there is a way to do this in power query but I dont know enough about it to figure out how.
    Attached Files Attached Files

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Trying to compare two dates cant figure out what im doing wrong.

    I may not be grasping the whole concept. (I know nothing of DAX or PQ.)

    I created a Table in CURRENT DATA and array entered this formula in D3. Your formula above suggests you want to work with Tables. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If you have thousands of rows this may not be practical. If you are not aware of it array formulas are resource hungry. Too many of them will slow your workbook.

    If you encounter problems with this formula are you open to helper columns? They can be hidden or put out of view (to the right?).

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    CURRENT DATA WANT TO SEE
    2
    Date Source Revenue Column1 Date Source Revenue Yesterdays Revenue
    3
    7/31/2017
    home depot
    50
    100
    7/31/2017
    home depot
    50
    100
    4
    7/30/2017
    home depot
    100
    null
    7/30/2017
    home depot
    100
    null
    5
    7/31/2017
    macys
    100
    50
    7/31/2017
    macys
    100
    50
    6
    7/30/2017
    macys
    50
    null
    7/30/2017
    macys
    50
    null
    Dave

  3. #3
    Registered User
    Join Date
    03-05-2011
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    84

    Re: Trying to compare two dates cant figure out what im doing wrong.

    There's no physical table to add a formula like that. Everything is loaded into the data model and there are millions of rows.

    Thanks anyway

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Trying to compare two dates cant figure out what im doing wrong.

    Millions?

    I hesitate to suggest this. It is all I have.

    Not sure how this is going to work. You can try it. It is non array and looks at all 1,048,576 rows. Even with the very limited data in your workbook it took a little over one second to calculate. In D3
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    With that much data to crunch I am not sure what else I can offer.

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    CURRENT DATA WANT TO SEE
    2
    Date Source Revenue Yesterdays Date Source Revenue Yesterdays Revenue
    3
    7/31/2017
    home depot
    50
    100
    7/31/2017
    home depot
    50
    100
    4
    7/30/2017
    home depot
    100
    null
    7/30/2017
    home depot
    100
    null
    5
    7/31/2017
    macys
    100
    50
    7/31/2017
    macys
    100
    50
    6
    7/30/2017
    macys
    50
    null
    7/30/2017
    macys
    50
    null
    Last edited by FlameRetired; 08-01-2017 at 09:38 PM. Reason: Date formatting corrections

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Trying to compare two dates cant figure out what im doing wrong.

    I over complicated this.

    Try
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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] Help - Unable to figure out what is wrong with the code
    By goudavnash.b in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-24-2017, 03:29 AM
  2. Can't figure out why the math is wrong here.
    By jerpeck in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2016, 04:21 AM
  3. [SOLVED] Can't figure out what I'm doing wrong - VBA help
    By tedkord in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-03-2015, 10:29 PM
  4. Replies: 4
    Last Post: 08-28-2014, 08:01 PM
  5. Troubleshoot my formula that I can't figure out what is wrong with
    By smockpuv in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-15-2013, 10:59 AM
  6. HELP, i am having an error and cant figure out whats wrong with my vba
    By basmienis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2012, 06:55 AM
  7. cant figure out what I'm doing wrong or missing...
    By soundengineer in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-25-2007, 07:40 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