Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello, I'm trying to get the max value in a group but still have it be affected by filters.
For example, I have a table that looks like this and I want to return the maximum value of transaction source for each client
| Client | Transaction Date | Transaction Source |
| Client A | 2024-09-01 | In store |
| Client A | 2024-10-01 | Online |
| Client A | 2024-11-01 | In store |
| Client B | 2024-10-01 | In Store |
| Client B | 2024-11-01 | In Store |
The result should be the following if there is no filter applied
| Client | Max Transaction Source |
| Client A | Online |
| Client B | In Store |
and I want the result to be the following if there is a filter on Transaction Date = 2024-11-01
| Client | Max Transaction Source |
| Client A | In Store |
| Client B | In Store |
I've tried using
Solved! Go to Solution.
Max =
CALCULATE (
MAX ( 'Table'[Transaction Source] ),
TOPN (
1,
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Client] = MAX ( 'Table'[Client] )
),
'Table'[Transaction Source],
DESC
)
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Max =
CALCULATE (
MAX ( 'Table'[Transaction Source] ),
TOPN (
1,
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Client] = MAX ( 'Table'[Client] )
),
'Table'[Transaction Source],
DESC
)
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@EVS5005 add DESC
Max =
CALCULATE (
MAX ( 'Table'[Transaction Source] ),
TOPN (
1,
ALLSELECTED ( 'Table' ),
'Table'[Transaction Date],
DESC
),
VALUES ( 'Table'[Client] )
)
but still not sure why you are getting Online for Client A when no filter is applied
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Online is the max value between Online and In Store, so if both exist the output would be Online.
This also doesn't work, its just taking the max value of everything and not grouping it by the client. It also doesn't change when I apply a filter on transaction date
The solution was based on the assumption that you are taking most recent transaction. Change the date column to source column
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
This kinda works for A, but since B doesn't have an "Online" value its being removed
@EVS5005 you are not explaining why you are getting online for client A, what is the logic behind it?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@EVS5005 it should work, share the sample data. in you original post this output is wrong, for client A it should be "in store" because the max date is 2024-11-01, not sure how you came up with online
| Client | Max Transaction Source |
| Client A | Online |
| Client B |
In Store |
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
and I want the result to be the following if there is no filter applied
| Client | Max Transaction Source |
| Client A | Online |
| Client B | In Store |
and I want the result to be the following if there is a filter on Transaction Date = 2024-11-01
| Client | Max Transaction Source |
| Client A | In Store |
| Client B | In Store |
@EVS5005 try this dax measure:
Max =
CALCULATE (
MAX ( 'Table'[Transaction Source] ),
TOPN (
1,
ALLSELECTED ( 'Table' ),
'Table'[Transaction Date]
),
VALUES ( 'Table'[Client] )
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
This doesn't work either, it just returns Online for everything
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.