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
Igotzepowerbi
Frequent Visitor

Calculating a rolling 52 for qty shipped

Hi,

 

I need to get a rolling 13 for quantity shipped. 

I have this for my units shipped but it has measures that are doing funky things with matching dates. (I didn't create this measure I am just updating the report). I am new to powerbi and really don't know what I am doing - please send help lol. I need it to be based off of invoice date in my order his table. Can someone help guide me? 

Rolling 13 POS Units =

    CALCULATE (
        [sum of units],
        FILTER ( 'POS Aggregate', 'POS Aggregate'[week diff POS] <= 12 ))

I created this and its not getting me the results I am wanting. 
Rolling 13  qty shipped =
CALCULATE (
    [sum of qty shipped],  
   DATESBETWEEN('Order History'[Invoice Date], TODAY() - 91, TODAY() - 1)
)
1 REPLY 1
rubayatyasmin
Super User
Super User

Hi, @Igotzepowerbi 

 

it would be better to create a date table instead of using today(). today will eventually change everyday. 

 

modified dax

 

Rolling 13 Weeks Qty Shipped =
CALCULATE(
SUM('Order History'[Qty Shipped]),
FILTER(
ALL('Date'[Date]),
'Date'[Date] >= MAX('Date'[Date]) - 91 &&
'Date'[Date] <= MAX('Date'[Date])
)
)

 

In this measure, Date would be a separate Date table that has all of the dates and 'Order History' is the table with your shipped quantities.

This assumes that the 'Date' table and the 'Order History' table are related by the date field.

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


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.