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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
rarcosta
Frequent Visitor

Total of a Measure - Matrix

Im facing the following problem and Im not able to solve. If anyone could help me, I would appreciate it very much!

 

Power BI matrix:

Equipment

First

Last

Difference

Truck

 

 

54

     Truck A

1

2

1

     Truck B

20

23

3

     Truck C

50

55

5

Total

 

 

54

 

First is a measure given by de minimum value of a column.

Last is a measure given bt th maximum value of the same column.

Difference is another measure given by Last - First.

 

I tried to use switch and isinscope, by I couldnt make the lines "Truck" and "Total" sum the results of the lines "Truck A", "Truck B" and "Truck C" in the column "Difference" (9).

 

Magic Measure =

SWITCH(

TRUE(),

ISINSCOPE('Table'[Equipment Type],[Difference],

ISINSCOPE('Table'[Equipment Name]),???????)

)

1 ACCEPTED SOLUTION
stevedep
Memorable Member
Memorable Member

Hi,

 

Its more simple:

Diff = 
var tbl = SUMMARIZE('table';'table'[Type];'table'[Name];"min"; MIN('table'[Value]);"max"; max('table'[Value]))
return
CALCULATE(SUMX(tbl;CALCULATE(max('table'[Value]))-CALCULATE(min('table'[Value]))))

 

trucks.png 

 

Power BI file is here.

 

Please mark as solution if this works for you. Thanks!

 

Kind regards,

 

Steve. 

View solution in original post

4 REPLIES 4
stevedep
Memorable Member
Memorable Member

Hi,

 

Its more simple:

Diff = 
var tbl = SUMMARIZE('table';'table'[Type];'table'[Name];"min"; MIN('table'[Value]);"max"; max('table'[Value]))
return
CALCULATE(SUMX(tbl;CALCULATE(max('table'[Value]))-CALCULATE(min('table'[Value]))))

 

trucks.png 

 

Power BI file is here.

 

Please mark as solution if this works for you. Thanks!

 

Kind regards,

 

Steve. 

That's it! Thank you!!

Anonymous
Not applicable

Hi,

 

Please see the solution on attached file.

 

If this post helps, then please consider Accepting it as the solution.

 

Thanks

Adi

Truck1.JPGTruck.JPG

Hi!

 

It's not possible to do like this, because both measures (First and Last) are calculated using values of the same column, like this:

 

TypeNameValue
TruckTruck A1
TruckTruck A2
TruckTruck B20
TruckTruck B21
TruckTruck B22
TruckTruck B23
TruckTruck C50
TruckTruck C51
TruckTruck C52
TruckTruck C53
TruckTruck C54
TruckTruck C55

First = MIN('table'[Value])

Last = MAX('tabel'[Value])

Difference = Last - First

 

So i cant calculate the Difference in the data table like you suggested.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.