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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors