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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
kkalyanrr
Helper V
Helper V

Finding difference between Max and Min values in a group and share accordingly

Hello,

I've a below scenario, where in I need to share a value with the group.
The idea is to make all the values close to one another.
In the below case I need to share 25 with the left group..
Since the difference between highest value and lowest value is 16.
I started with 16 in the result column.Please help.

kkalyanrr_0-1649671993186.png

Thanks.

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi  @kkalyanrr ,

It seems to me that based on the template you have provided so far, the figure you want to share is 26, not 25.26 is the sum of all the differences. 

Refer the following measure:

diff = var  value1=CALCULATE(MAX('Table'[Value]),ALL('Table')) -CALCULATE(MAX('Table'[Value]),filter(ALL('Table'),'Table'[Group]=MAX('Table'[Group])))  return value1
maxdiff = MAXX('Table','Table'[diff])
sumdiff = SUMX('Table','Table'[diff])

vluwangmsft_0-1650010537590.png

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi  @kkalyanrr ,

It seems to me that based on the template you have provided so far, the figure you want to share is 26, not 25.26 is the sum of all the differences. 

Refer the following measure:

diff = var  value1=CALCULATE(MAX('Table'[Value]),ALL('Table')) -CALCULATE(MAX('Table'[Value]),filter(ALL('Table'),'Table'[Group]=MAX('Table'[Group])))  return value1
maxdiff = MAXX('Table','Table'[diff])
sumdiff = SUMX('Table','Table'[diff])

vluwangmsft_0-1650010537590.png

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

amrans
Frequent Visitor

I have showcased my working in both cases when you want to compare with maximum value in table or maximum value in selection. Few measures were developed to get desired result. 

Solution New 1.PNG

 

 

List of Measures are below

 

Current Row Value = MAX(SampleTable[Values])
Max All Values = MAXX(All(SampleTable),SampleTable[Values])
Difference All Max = SampleTable[Max All Values]-[Current Row Value]
 
Max All Selected Values = MAXX(ALLSELECTED(SampleTable),SampleTable[Values])
Difference All Selected Max = SampleTable[Max All Selected Values]-[Current Row Value]
 
amitchandak
Super User
Super User

@kkalyanrr , In this case it

 

max(Table[Value]) - Min(Table[Value])

 

or

 

calculate(max(Table[Value]) - Min(Table[Value]) , allselected()  )

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.