Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Jpahl2033
Helper I
Helper I

Latest Date when refreshedfor Day over Day

Hi,

 

I am trying to figure out a way when i refresh my data at the end of the day, the measure would pull the latest Day over Day measure. For example, if i refreshed my data at the end of today (June 16th) and i look at it later today or even tomorrow before the next refresh would happen, it would show the day over day % change for June 16th. If you need a value, you can use sales as a sample value. 

 

Let me know if it is possible. Thanks! 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Jpahl2033 ,

According to your description, I create a sample.

vkalyjmsft_0-1656056435677.png

If you want to show the division of the previous day and the latest day, here's my solution.

Create a measure.

Day over Day =
VAR _Today =
    CALCULATE (
        SUM ( 'orders data weekly'[Sales] ),
        'orders data weekly'[OrderDate]
            = MAXX ( ALL ( 'orders data weekly' ), 'orders data weekly'[OrderDate] )
    )
VAR _Pre =
    CALCULATE (
        SUM ( 'orders data weekly'[Sales] ),
        'orders data weekly'[OrderDate]
            = MAXX ( ALL ( 'orders data weekly' ), 'orders data weekly'[OrderDate] ) - 1
    )
RETURN
    DIVIDE ( _Pre, _Today )

Get the result.

vkalyjmsft_1-1656056631174.png

I attach the sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @Jpahl2033 ,

According to your description, I create a sample.

vkalyjmsft_0-1656056435677.png

If you want to show the division of the previous day and the latest day, here's my solution.

Create a measure.

Day over Day =
VAR _Today =
    CALCULATE (
        SUM ( 'orders data weekly'[Sales] ),
        'orders data weekly'[OrderDate]
            = MAXX ( ALL ( 'orders data weekly' ), 'orders data weekly'[OrderDate] )
    )
VAR _Pre =
    CALCULATE (
        SUM ( 'orders data weekly'[Sales] ),
        'orders data weekly'[OrderDate]
            = MAXX ( ALL ( 'orders data weekly' ), 'orders data weekly'[OrderDate] ) - 1
    )
RETURN
    DIVIDE ( _Pre, _Today )

Get the result.

vkalyjmsft_1-1656056631174.png

I attach the sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Jpahl2033
Helper I
Helper I

@Greg_Deckler

This is my current measure. do you know where i would put that?

Day over Day =
VAR
_prev = IF(
NOT( ISBLANK( [Total Sales]))
, CALCULATE([Total Sales]
, PREVIOUSDAY('orders data weekly'[OrderDate])))

RETURN

DIVIDE( ( [Total Sales] - _prev ),_prev)

@Jpahl2033 In theory: PREVIOUSDAY(MAX('new query'[Last Refreshed]))


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@Jpahl2033 Often you just create a query for this that returns a single row and column that is the last refreshed time. DateTime.LocalNow(). Then you can use that in your DAX measures to calculate based upon the last refreshed date.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.