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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BeaBF
Impactful Individual
Impactful Individual

Min of ABS Measure

Hello everyone! This time I need you.

I need to calculate the minimum value among the absolute values ​​of a column grouped by key, in order to put in that line the sum of the same column. 

I try to explain, the data:


CHIAVE DELTA_ADJ
AAA -444,471873
AAA 380,175
BBB -28323017,83
BBB -80752,60925

 

I need to compute the sum of the column DELTA_ADJ grouped by CHIAVE, so:

-64,296873
-28403770,44

 

 

and put it in correspondence with the minimum value of the absolute value of each key, in this way:

CHIAVE DELTA_ADJ MIN VALUE
AAA -444,471873 0
AAA 380,175 -64,296873
BBB -28323017,83 0
BBB -80752,60925 -28403770,44

 

EVERYTHING MUST BE DONE BY MEASURE, WITHOUT CALCULATED COLUMNS

THX,

BF

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @BeaBF 
You can try https://we.tl/t-rWuYaQz0GU

MIN VALUE = 
VAR AbsCurrentValue = ABS ( MAX ( Data[DELTA_ADJ] ) )
VAR ChiaveTable = CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[CHIAVE] ) )
VAR GroupedBySum = SUMX ( ChiaveTable, Data[DELTA_ADJ] )
VAR AbsMinValue = MINX ( ChiaveTable, ABS ( Data[DELTA_ADJ] ) )
VAR Result = IF ( AbsCurrentValue = AbsMinValue, GroupedBySum, 0 )
RETURN
    Result

1.png

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @BeaBF 
You can try https://we.tl/t-rWuYaQz0GU

MIN VALUE = 
VAR AbsCurrentValue = ABS ( MAX ( Data[DELTA_ADJ] ) )
VAR ChiaveTable = CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[CHIAVE] ) )
VAR GroupedBySum = SUMX ( ChiaveTable, Data[DELTA_ADJ] )
VAR AbsMinValue = MINX ( ChiaveTable, ABS ( Data[DELTA_ADJ] ) )
VAR Result = IF ( AbsCurrentValue = AbsMinValue, GroupedBySum, 0 )
RETURN
    Result

1.png

BeaBF
Impactful Individual
Impactful Individual

@tamerj1 

Crazy! that's just what I wanted!

A thousand thanks!

 

BF

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors