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
sfanget
Regular Visitor

Highest value of a "moving 30 days sum measure" over time

Hello all,


I have a table with basically the following columns :
- POS ID

- Reference ID
- Date
- Daily Sales

I have created a "moving 30 days sales" measure with this formula :

30daysSales =
CALCULATE(
SUM(Table[Daily Sales])
, DATESINPERIOD(Table[Date], MAX(Table[Date]), -30,DAY)
)

Now I try to get the highest value of this "30daysSales" over the time horizon for each POS & Reference

MAXX(Table, [30daysSales])

does not fullfill my hope !

Any help appreciated
1 ACCEPTED SOLUTION

MAXX(
    KEEPFILTERS(VALUES('Calendar'[Date])),
    CALCULATE(30daysSales)
)
Does the trick !

View solution in original post

3 REPLIES 3
sfanget
Regular Visitor

Hello
Thanks for your time.

Unfortunately, as mentionned, a simple MAXX does not do the trick.

If I filter the table to latest 30 days, it gives the latest value of the measure, not the highest of all time horizon

MAXX(
    KEEPFILTERS(VALUES('Calendar'[Date])),
    CALCULATE(30daysSales)
)
Does the trick !
ribisht17
Super User
Super User

@sfanget 

 

MAXX(Table, [30daysSales])

 

Filter this Table to Last 30 Days and then Find the max of Sales

 

Something like this https://docs.microsoft.com/en-us/dax/maxx-function-dax

 

Thanks,
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 

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.

Top Solution Authors