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
SteveD2
Resolver I
Resolver I

What's the difference between Firstdate/Lastdate(Date.Date) and Max/Min(Date.Date)?

I'm curious to know what the difference is as using this equation

 

Calculate( [Total],
Filter(All(Date), Date[Date] < Firstdate(Date[Date]))

 

yeilds blank as a result but,

 

Calculate([Total],
Filter(All(Date), Date[Date] < Min(Date[Date])) gives the correct result.

I assume Firstdate/Lastdate is syntax candy and contains a calculate statement which changes the filter context but, why?

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

Hi SteveD2,

 

Firstdate() returns a table with only one value so can't find a value less than the value itself. So Date[Date] < Firstdate(Date[Date]) will return blank.Please refer to this blog: http://sqlblog.com/blogs/marco_russo/archive/2013/10/22/difference-between-lastdate-and-max-for-semi....

 

In addtion, you can use 

result = Calculate( MAX('Date'[Date]),
LASTDATE('Date'[Date]))

instead of

result = Calculate( MAX('Date'[Date]),
FILTER('Date', 'Date'[Date] = MAX('Date'[Date])))

2.PNG捕获.PNG 

 

Regards,

Jimmy Tao

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi SteveD2,

 

Firstdate() returns a table with only one value so can't find a value less than the value itself. So Date[Date] < Firstdate(Date[Date]) will return blank.Please refer to this blog: http://sqlblog.com/blogs/marco_russo/archive/2013/10/22/difference-between-lastdate-and-max-for-semi....

 

In addtion, you can use 

result = Calculate( MAX('Date'[Date]),
LASTDATE('Date'[Date]))

instead of

result = Calculate( MAX('Date'[Date]),
FILTER('Date', 'Date'[Date] = MAX('Date'[Date])))

2.PNG捕获.PNG 

 

Regards,

Jimmy Tao

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.