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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

sum of max-min per category

Hi, 

 

I would to get the difference between max value and min value per category. And sum those differences later.

Should i use somekind of sumX?

1 ACCEPTED SOLUTION

@Anonymous add this measure to sum up min/max difference

 

Min Max Total = SUMX( VALUES( Table1[Type] ), [Min Max Diff] )

 

 



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.

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@Anonymous not sure how your data looks like but something like this will work, add new measure as shown below

 

drop category and following measure in table visual and you will have the result

 

Difference Min and Max = 
MAX( Table[Value] ) - MIN( Table[Value] )


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.

Anonymous
Not applicable

Tnx for your reply @parry2k , but what if want to have the sum of the differences in a card visuals and this changes with filters like date etc..

 

example:

a 2

a 1

b 3

b 10

Normal max-min  = 10-1 =9

per cat : a = 2-1 =1

              b = 10-3 =7

Sum a +b = 8 -----> this is what i need i a card visual

 

 

@Anonymous add this measure to sum up min/max difference

 

Min Max Total = SUMX( VALUES( Table1[Type] ), [Min Max Diff] )

 

 



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.

Anonymous
Not applicable

@parry2k It does not show the correct answer unfortunately

 

@Anonymous solution attached, not sure why it is not working for you



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.

Anonymous
Not applicable

@parry2k 
I tried to put everyting in one measure and it does not work:

Min Max Total 2 = var MinMaxDiff = MAX(Table1[Value])-MIN(Table1[Value])
return
SUMX(VALUES(Table1[Type]);MinMaxDiff)
 
But if a tried what you described:
Min Max Diff = MAX( Table1[Value] ) - MIN( Table1[Value])
Min Max Total = SUMX( VALUES( Table1[Type] ); [Min Max Diff] )
 
then i works. Not sure why the var method does not work.
Grateful if you could explain it to me!
 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.