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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
barron2020
Frequent Visitor

Difference of columns of a filtered row

All

 

Below is my data:

 

SKU - Weight in Kg 

SKU1 - 50

SKU2 - 100

SKU3 - 150

SKU4 - 200

 

If i filter for SKU2 and SKU3, and I create a measure to calculate min weight from filtered row, it will be like this:

SKU - Weight in Kg Min Weight

SKU2 - 100 - 100

SKU3 - 150 -100

 

But when i create a new column to find the difference in weight, it is taking min weight from the original data.

This is the result i get now:

SKU - Weight in Kg Min Weight  - Difference between WEight in Kg and Min Weight

SKU2 - 100 - 100 -                          50 (100-50)

SKU3 - 150 -100                              100 (150-50)

 

What i want to get is:

This is the result i get now:

SKU - Weight in Kg Min Weight  - Difference between WEight in Kg and Min Weight

SKU2 - 100 - 100 -                          0 (100-100)

SKU3 - 150 -100                              50 (150-100)

 

Please assist.

2 REPLIES 2
M_L
Frequent Visitor

hello, I would use the Min Weight based on ALLSELECTED & a difference with HASONEVALUE to get the current [Weight in Kg]

 

Min Weight = MINX(ALLSELECTED('Table');'Table'[Weight in Kg])

Difference between WEight in Kg and Min Weight =
VAR __Current_Weight = If(HASONEVALUE('Table'[Weight in Kg]);VALUES('Table'[Weight in Kg]))
RETURN __Current_Weight - [Min Weight]

 

Let me know if that helps.
barron2020
Frequent Visitor

For second column, the formula used is minx(allselected(table),"weight in kg")

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors