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
EnrichedUser
Helper III
Helper III

Max Date Minus X Days

Hi,

 

I am hoping this is a fairly easy one and that I am missing something simple.

 

Goal: Evaluate up to the selected date minus 2 days. 

I have two tables, one is a date table "Date" and the other is "SalesOrders"

I have the dax messures:

Picking Backlog =
IF(ISBLANK( [Picks Needed]),
BLANK(),
CALCULATE( [Picks Needed],
FILTER( ALLSELECTED('Date'),
'Date'[Date] <= MAX('Date'[Date]))))

and

Picks Needed =
CALCULATE(COUNT(SalesOrders[Status]), SalesOrders[Status] = "OPEN", SalesOrders[OrderStatus] <> "R")

My goal is use the Picking Backlog Messure but instead of counting to MAX('Date'[Date]), I want to count to the Max Date minus X days. Where X will be 2 for now. 
 
Example:

PickingBacklog
3/2 = 300
3/3 = 340
3/4 = 395
 
Exepected Outcome 
PickingBacklog2days = 300
One Number, Card Visual 
 -----------
Notes

I have tried using the date add function, but the limitation of Max being assest on a column has made it difficult. 
Sample Sales Order Data
BranchID    Date   SalesOrderID     Line Number   Status   Total Price
A3/3S1001Open100
A3/4S1001Open200
B3/3S1021Open300
B3/3S1032Closed400
C3/4S1041Open500
C3/2S1051Closed600
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @EnrichedUser 

Deduct 2 from the Max Date e.g.

 

Picking Backlog =
IF(ISBLANK( [Picks Needed]),
BLANK(),
CALCULATE( [Picks Needed],
FILTER( ALLSELECTED('Date'),
'Date'[Date] <= (MAX('Date'[Date]) - 2) )))

 

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @EnrichedUser 

Deduct 2 from the Max Date e.g.

 

Picking Backlog =
IF(ISBLANK( [Picks Needed]),
BLANK(),
CALCULATE( [Picks Needed],
FILTER( ALLSELECTED('Date'),
'Date'[Date] <= (MAX('Date'[Date]) - 2) )))

 

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


I am sure I tried this and variations of this multiple times before posting this...

thank you

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.