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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
dading
Helper II
Helper II

calculate total hour

Hello all,

i have table like this

DateEqmtStatusduration_hour
01-Jan-20E1b1
01-Jan-20E1c5
01-Jan-20E2a4
01-Jan-20E2b4
02-Jan-20E1a1
02-Jan-20E1b5
02-Jan-20E1c2
02-Jan-20E2a4
02-Jan-20E2b3

 

i want to create measure to  calculate daily total hour for each eqmt then i calculate status per hour.

example:

total hour of E1 on 01-Jan-20 = 1+5 =6

then i want to get status per hour of b = 1/6 = 0.17

and c = 5/6 = 0.83

 

the result i want as shown below

DateEqmtStatusduration_hourTotal Hour per EqmtStatus per hour
01-Jan-20E1b16                                0.17
01-Jan-20E1c56                                0.83
01-Jan-20E2a48                                0.50
01-Jan-20E2b48                                0.50
02-Jan-20E1a18                                0.13
02-Jan-20E1b58                                0.63
02-Jan-20E1c28                                0.25
02-Jan-20E2a47                                0.57
02-Jan-20E2b37                                0.43

 

Can you help me, please??

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @dading 

try measure

Total Hour per Eqmt = 
CALCULATE(SUM(Table[duration_hour]), ALLEXCEPT(Table, Table[Eqmt], Table[Date]) )

then measure

Status per hour = 
DIVIDE(SELECTEDVALUE(Table[duration_hour]), [Total Hour per Eqmt])

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@dading ,

Try like

new Measure =

sum(Table[duration_hour])/calculate(sum(Table[duration_hour]),allexcept(Table[Eqmt]))

 

New column =[duration_hour]/sumx(filter(Table,[Eqmt]=earlier(Eqmt)),[duration_hour])

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
az38
Community Champion
Community Champion

Hi @dading 

try measure

Total Hour per Eqmt = 
CALCULATE(SUM(Table[duration_hour]), ALLEXCEPT(Table, Table[Eqmt], Table[Date]) )

then measure

Status per hour = 
DIVIDE(SELECTEDVALUE(Table[duration_hour]), [Total Hour per Eqmt])

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Amazing....

 

thank you @az38 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.