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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Customized average in DAX measure

I am quite new to Power Bi and need some help with a DAX measure.
I have a table that contains charging cables and the amount of time they have been used. I would like to calculate the capacity utilization, i.e. how much percentage of the total time have the cables been used in average.
The cables are grouped and cannot be used all at the same time. The variable max_concurrent tells us how many of them can be used. Furthermore, cable c2-1 has not been there at 0:00-01:00, just at 01:00-02:00.


Think of tables like this:

charge_time:

Cable

timestamp

charge_time_sec

C1-1

0:00-1:00

1800

C1-2

0:00-1:00

900

C1-3

0:00-1:00

0

C1-1

1:00-2:00

3600

C1-2

1:00-2:00

0

C1-3

1:00-2:00

2700

C2-1

1:00-2:00

450

 

metadata

cable

group

max_concurrent

C1-1

C1

2

C1-2

C1

2

C1-3

C1

2

C2-1

C2

1

 

Calculations:

0:00-01:00: (1800+900+0)/(2*3600) = 37.5 %

1:00-2:00: (3600+0+2700+450)/(3*3600) = 62.5 %

Average: 50 %
I wrote the following measure that is working but slow.


caputil avg = var _table=SUMMARIZE(

  charge_time,

  charge_time[timestamp],

  "caputil",

  DIVIDE(SUM([charge_time_sec]),3600*[max concurrent cables])

) return

CALCULATE(AVERAGEX(_table,[caputil]))

 

max concurrent cables = SUMX(Distinct(metadata[group]), [max concurrent group])

max concurrent group = MAX(metadata[max_concurrent])

 

I would be really happy about any advice 😊 Thanks!

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

divide(Sum(Table[charge_time_sec]),distinctcount(Table[Cable])*distinctcount(Table[timestamp])*3600)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi,

thanks for the answer, but it is not working for my task.
That would work if all the cables could be used at the same time.
But as you see in my calculations, I would like to divide by 2*3600 at the first timestamp and 3*3600 at the second timestamp...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.