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
spitfyah
Frequent Visitor

Maxx Function Filtering on two columns?

EDIT: For anyone that finds this on Google, the solution is, as the guy below said:

 

MaxInteractionStart = maxx(
FILTER(
Fact_Interaction,
Fact_Interaction[InteractionID] =earlier(Fact_Interaction[InteractionID]) &&
Fact_Interaction[InteractionRank] = <something goes here>
),
Fact_Interaction[InteractionStartDate])

thanks a bunch @Greg_Deckler 

 

Original Q below:

 

So I know how to get the max of something based on colummn but I would like to filter by two columns.

See the function below, this gives me the max date for every InteractionID, but I also have an Interaction Rank so I would like the max InteractionStartDate based on both InteractionID and InteractionRank, where would I add this in?

MaxInteractionStart = maxx(
FILTER(
Fact_Interaction,
Fact_Interaction[InteractionID] =earlier(Fact_Interaction[InteractionID])
),
Fact_Interaction[InteractionStartDate])

 

 

how would I add a second filter for InteractionRank?

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@spitfyah Try:

MaxInteractionStart = maxx(
FILTER(
Fact_Interaction,
Fact_Interaction[InteractionID] =earlier(Fact_Interaction[InteractionID]) &&
Fact_Interaction[InteractionRank] = <something goes here>
),
Fact_Interaction[InteractionStartDate])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@spitfyah Try:

MaxInteractionStart = maxx(
FILTER(
Fact_Interaction,
Fact_Interaction[InteractionID] =earlier(Fact_Interaction[InteractionID]) &&
Fact_Interaction[InteractionRank] = <something goes here>
),
Fact_Interaction[InteractionStartDate])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hey, This actually worked! I actually had this code before and was getting a syntax error because I had put my contact rank in quotations (thus having the function look for text instead of the number.) It worked, but just one request, the earlier() bit of the function does not seem to be doing what I want it to do, is there are better function that will get the filter to look through all instances of the InteractionIDs in my table?

 

Thanks bro!

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.