cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SteveD2 Regular Visitor
Regular Visitor

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

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

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

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
Highlighted
Community Support Team
Community Support Team

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

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

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 44 members 921 guests
Please welcome our newest community members: