cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lcasey Member
Member

MAX does not return the correct value

Hello,

 

How come the MAX formula does not work in Power BI?

 

When I use:  maxDate = LASTDATE(ALLSELECTED('Calendar'[Date]))
 

when a user changes the claendar slicer to another date teh maxDate is still the same exact date without changing to what the user selected.

 

Is there a way to have the maxDate change to the last date of the calendar selection made by the end user?

 

4 REPLIES 4
lcasey Member
Member

getting the Max date from a date slicer

Hello ,

 

Does anyone know what formula I would need to use to always get the MAX date from a selection in a calander table?

 

I have a date slicer that users can choose dates between a range. I want a field that will get the max dat of that selection.

 

My formula is this:  MAX('Calendar'[Date])

 

But that always returns the same exact date which is the last date in the calendar table. If a user selects a different date, I need thhe formula to use the last date of the calendar table.

lcasey Member
Member

MAX does not returnm the correct value

Hello,

 

How come the MAX formula does not work in Power BI?

 

When I use:  maxDate = LASTDATE(ALLSELECTED('Calendar'[Date]))
 

when a user changes the claendar slicer to another date teh maxDate is still the same exact date without changing to what the user selected.

 

Is there a way to have the maxDate change to the last date of the calendar selection made by the end user?

 

nickchobotar Established Member
Established Member

Re: MAX does not return the correct value

@lcasey

 

You sure can.  You got the two options below:

= LASTDATE ( 'Date'[Date] )

You can still use ALLSELECTED, but only as CALCULATE simple filter argument. =
CALCULATE ( 
    LASTDATE ( 'Date'[Date] ),
    ALLSELECTED () 
)

N -

Community Support Team
Community Support Team

Re: MAX does not returnm the correct value

Hi @lcasey,

 

If you have any other filters apply on current table, you can user allselected function with table name to apply all filters effect.

maxDate = LASTDATE(ALLSELECTED('Calendar'))

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors