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

days since last order

Hi, 

My model has 3 tables Sales, Date and Customer. Sales table has relationship with Customer and Date.

I want to calculate customer wise no. of days since they given their last order. I tried few measures to calculate the last order date but they are giving future date as my date dimenison has future dates.

 

MAXX( FILTER( 'Date','Date'[Sales order date] <= TODAY() ), 'Date'[Sales order date])
LASTDATE('Sales order date'[Sales order date])

 

please suggest how to get this.

 

Thanks

 

 

1 ACCEPTED SOLUTION
ajve22
Frequent Visitor

Hi,

This was due to single cross filter direction from date to sales table. Here trying to slice the date with customers, so setting up cross filter direction as both solved the problem.

 

thanks

View solution in original post

2 REPLIES 2
ajve22
Frequent Visitor

Hi,

This was due to single cross filter direction from date to sales table. Here trying to slice the date with customers, so setting up cross filter direction as both solved the problem.

 

thanks

PC2790
Community Champion
Community Champion

I see that you are picking the columns from Date Table though it should be:

LastOrderDate=MAXX( FILTER( 'Sales','Sales'[Sales order date] <= TODAY() ), 'Sales'[Sales order date])

or 

LastOrderDate = LASTDATE(Orders[OrderDate])

This should give the right result.

 

If you are looking for something else, please shout out

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.