March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Hi,
I'm trying to calculate the max value by using group by for multiple columns.
I Have this table :
What I want to do is to calculate the max amount for each "Id offer" by selecting the "Rev" with the maximum amount for each "Id client" as below :
If the offer has multiple "Id client" , in this case selecting the "Id client" column with the max value as below :
I'm trying this but it doesn't work :
Max amount = GROUPBY( ADDCOLUMNS( GROUPBY( Tableau_Quotation, 'Tableau_Quotation'[Document Nr], 'Tableau_Quotation'[Rev], ), "Max Count", CALCULATE(MAX(Tableau_Quotation[Offer amount EUR])) ), 'Tableau_Quotation'[Document Nr], "Max", MAXX(CURRENTGROUP(), [Max Count]))
How I can fix that with dax ?
Thanks in advance
Solved! Go to Solution.
@K-LED ,
If I understand this correctly, you are creating a new table. I used SUMMARIZE and LOOKUPVALUE
new = SUMMARIZE('Table','Table'[ID Offer],'Table'[ID Client],"AMT",max('Table'[Amount])), == Lookup = LOOKUPVALUE('Table'[Rev],'Table'[Amount],new[AMT],'Table'[ID Offer],new[ID Offer],'Table'[ID Client],new[ID Client])
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Will post pbix shortly.
Proud to be a Super User!
@K-LED ,
If I understand this correctly, you are creating a new table. I used SUMMARIZE and LOOKUPVALUE
new = SUMMARIZE('Table','Table'[ID Offer],'Table'[ID Client],"AMT",max('Table'[Amount])), == Lookup = LOOKUPVALUE('Table'[Rev],'Table'[Amount],new[AMT],'Table'[ID Offer],new[ID Offer],'Table'[ID Client],new[ID Client])
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Will post pbix shortly.
Proud to be a Super User!
Hi,
Thanks for your response @Nathaniel_C ,
If it's possible I'd like to not create a new table but creating a new measure at the same table.
Otherwise with your solution you miss the last step by selecting the "Id offer" with the max "AMT":
Id Offer | ID Client | AMT | Lookup
1 | B | 150 | 2
Can we use the same functions without creating a new table but stay with the same table ?
Thnak you again for your answer!
Hi @K-LED ,
Maybe I am not seeing for what you are looking.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Aren't these the same?
Proud to be a Super User!
Hii,
I added a step to select the line with the max amount...
Thank you again for your answer
Regards.
You are welcome!
Proud to be a Super User!
PBIX file PBIX
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |