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
lcasey
Post Prodigy
Post Prodigy

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
nickchobotar
Skilled Sharer
Skilled Sharer

@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 -

lcasey
Post Prodigy
Post Prodigy

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?

 

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
If this post helps, please consider accept as solution to help other members find it more quickly.
lcasey
Post Prodigy
Post Prodigy

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.

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.