Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
danextian
Super User
Super User

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."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
1 ACCEPTED SOLUTION

@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."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

5 REPLIES 5
MFelix
Super User
Super User

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 Super User!

Check out my blog: Power BI em Português



@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."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
mbm
Frequent Visitor

Thanks @danextian . Sometimes a big problem can be solved with simple solutions. Your suggestion here made my day peaceful.

Hi @mbm ,

This was from my early DAX days when I was  still a newbie and not yet a super user.










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."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.