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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
axa830
Frequent Visitor

Calculating the total for a date and the average for a specific period

Hello All,

 

 I am very new to powerBi and seem to have got stuck. My data is structured as belowpowerBIquestion.PNG

 

What I want to achieve is get the run time for each device for a particular date. For example for device A on Jan 18th the total would come to 121. Using this total I want to subtract it from a specific number(86400) to get the idle time for that day.

 

My end goal is to calculate utilization of a machine for a given day or the average utilization for a period of days.

For example : if i slice my data for device A on Just 18th Jan, the utilization will be 121/86400.

                       But if i slice my data for device A  for the period Jan 18th and 19th , it would be (Average of 121 & 700)/ 86400.

 

Please advise as I am stuck and cant seem to calculate the averages or the total sum for a period or a single day.

 

 

 

 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI, @axa830

You could use HASONEVALUE Function to create a measure like below:

Measure =
IF (
    HASONEVALUE ( 'Table'[Date Received] ),
    CALCULATE ( SUM ( 'Table'[True Run Time] ) ),
    AVERAGE ( 'Table'[True Run Time] )
)

Result:

Select one dateSelect one dateSelect one dateSelect one dateSelect multiple dateSelect multiple date

Best Regards,
Lin

 

 

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lili6-msft
Community Support
Community Support

HI, @axa830

You could use HASONEVALUE Function to create a measure like below:

Measure =
IF (
    HASONEVALUE ( 'Table'[Date Received] ),
    CALCULATE ( SUM ( 'Table'[True Run Time] ) ),
    AVERAGE ( 'Table'[True Run Time] )
)

Result:

Select one dateSelect one dateSelect one dateSelect one dateSelect multiple dateSelect multiple date

Best Regards,
Lin

 

 

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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