cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GilesWalker Skilled Sharer
Skilled Sharer

Re: Set a filter based on MAX

@Greg_Deckler - I found this page which described it well:

 

https://msdn.microsoft.com/en-us/library/ee634795.aspx

 

Thansk again.

 

Giles

Super User IV
Super User IV

Re: Set a filter based on MAX

@GilesWalker - Cool, glad we could arrive at a solution.

 

The ALLEXCEPT formula removes all context except for filters applied to the specified column(s) as explained here:

https://msdn.microsoft.com/en-us/library/ee634795.aspx

 

So, basically the ALL filter was removing all context from the CALCULATION, meaning that it returned the highst (MAX) value from all of the rows.

 

The ALLEXCEPT preserves the "Train Id" context but removes all other context like date, etc, meaning that the use of ALLEXCEPT returns the highest (MAX) value from all of the rows filtered by the "Train Id" context of the row of the visualization, and ONLY the Train Id context of the visualization row.

 

If you are truly thinking DAX, you are thinking in terms of the "context" in which the DAX formula is being executed. Weird, because most other languages do not so heavily feature context as a thing, but DAX does. In my opinion, this is one of the most powerful things about DAX is that you can essentially create dynamic "views" of the same data, the views basically translating to context. Generally in most other languages, there is a single context by which you process information. The flexibility of dynamically creating context makes DAX super cool and powerful, but it is a learning curve at the same time.


---------------------------------------

Not the Power BI thought police...

I have NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

SteffanPE
Regular Visitor

Re: Set a filter based on MAX

i'm having a very similar problem, however i'm struggling to get this to work.

 

is the - max = CALCULATE(MAX(Train_Movements[sequence]),ALL(Train_Movements) you mention a custom column or something else?

 

in my table the JAP_SEQUENCE column indicates the most recent appointment date against a specific job - JAP_JOB_REF. 

 

I need to create a custom column like yourself which indicates a 1 against the most recent appointment (highest sequence number against the specific job) and a 0 againt old appointment, I can then filter out the 0 and have a table which only shows the most recent appointment date.

Highlighted
SteffanPE
Regular Visitor

Re: Set a filter based on MAX

image.png

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