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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
laciodrom_80
Helper IV
Helper IV

Hint about DAX calculation

Hi all,

I've got a table with a string column Customer, a number column Revision and a number column Price: I wish to sum all values in Price column but only considering the max revision value for the same customer columns values.

 

 

CUSTOMER       REVISION     PRICE
CustomerA          100        2
CustomerB          80         4
CustomerB          81         6
CustomerC          10         5
CustomerD          14         2
CustomerD          15         3

 

 

I'd like to obtain: 2+6+5+3 = 16

What DAX expression should I use?

 

Thanks a lot for any clue!

Luca
1 ACCEPTED SOLUTION

Hi @laciodrom_80 , 

 

Would you please use the following measure ?

 

Measure = SUMX(ADDCOLUMNS(SUMMARIZE('Table','Table'[CUSTOMER],"maxrevision",MAX('Table'[REVISION])),"_price",CALCULATE(MAX('Table'[Price]))),[_price])

 

Capture3.PNG

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@laciodrom_80 , Try like

 

sumx(values(Table[CUSTOMER]) ,calculate(max(Table[price])))

 

or

sumx(Summarize(Table,Table[CUSTOMER],"_1" ,calculate(max(Table[price]))),[_1])

or

sumx(values(Table[CUSTOMER]) ,(max(Table[price])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak thanks, but I've modified the post in the meantime, it's a bit different

Luca

Hi @laciodrom_80 , 

 

Would you please use the following measure ?

 

Measure = SUMX(ADDCOLUMNS(SUMMARIZE('Table','Table'[CUSTOMER],"maxrevision",MAX('Table'[REVISION])),"_price",CALCULATE(MAX('Table'[Price]))),[_price])

 

Capture3.PNG

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

@laciodrom_80 , Try like

sumx(values(Table[CUSTOMER]) ,lastnonblankvalue(table[revision ],max(Table[price])))

 

In visual  take max or last of revision, if needed

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.