cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User I
Super User I

MAX showing incorrect value

Hi,

 

I find this weird but I may be doing it wrong.

 

Basically, what I am trying to accomplish is get the max date in the date table which is filtered to start from 1/1/17 until date today (done using DateTime.Date(DateTime.LocalNow()) function). If the date today is 7/18/17, the max date should be that date but the result of my DAX formula is 12/31/17. 

 

The following are the formulas I'm using:

 

MaxDate =
MAX ( Calendar[Date].[Date] )

MaxDate with Calculatte =
CALCULATE ( MAX ( Calendar[Date].[Date] ), ALL ( Calendar ) )

 






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
www.linkedin.com/in/danebelarminocpa
1 ACCEPTED SOLUTION

Accepted Solutions
Super User I
Super User I

Re: MAX showing incorrect value

@MFelix

 

Thanks for the response but as mentioned, my calendar table's maximum value is the current date so it should be 7/18.

But I've figured out where I went wrong. By adding a .[Date] after Calendar[Date], the measure uses the hidden table created by PBI desktop's time intelligence featture.  Removing  .[Date] solves the problem. 






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
www.linkedin.com/in/danebelarminocpa

View solution in original post

3 REPLIES 3
Super User III
Super User III

Re: MAX showing incorrect value

Hi @danextian,

 

The question is that you are using the ALL and by doing that you discard all the filter you have on the Calendar date and return the maximum value of the full table ignoring all the rest of the filters you need to do something like this:

 

MaxDate with Calculatte ALLSELECTED =
CALCULATE ( MAX ( Calendar[Date] ), ALLSELECTED ( 'Calendar'[Date] ) )

As you can see below I have made a print with your two formulas and mine with a slicer see the result:

 

max.png

 

Regards,

Mfelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Check out my blog: Power BI em Português


Super User I
Super User I

Re: MAX showing incorrect value

@MFelix

 

Thanks for the response but as mentioned, my calendar table's maximum value is the current date so it should be 7/18.

But I've figured out where I went wrong. By adding a .[Date] after Calendar[Date], the measure uses the hidden table created by PBI desktop's time intelligence featture.  Removing  .[Date] solves the problem. 






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
www.linkedin.com/in/danebelarminocpa

View solution in original post

Microsoft v-yulgu-msft
Microsoft

Re: MAX showing incorrect value

Hi @danextian,

 

Thanks for your sharing. Please kindly mark the corresponding resolution as an answer so that it can benefit more users.

 

Thanks,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors