Forum Discussion
Calculating Average from a measure
Hello,
I have a dataset where I am trying to find the average of a measure to show it as a card on my dashboard.
I have used the following measure code to get the time duration between two dates:
- Anonymous2 years ago
Hi, Anonymous
I create a sample table:
Then create a new measure and try the following DAX expression:
AverageDowntime = DIVIDE( SUMX(VALUES('Table'[Message number]), CALCULATE( DATEDIFF(MIN('Table'[APPEARED]), MIN('Table'[DISAPPEARED]), MINUTE) + (SECOND(MIN('Table'[DISAPPEARED])) - SECOND(MIN('Table'[APPEARED]))) / 60 )), DISTINCTCOUNT('Table'[MESSAGE NUMBER]) )Here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- bhanu_gautam
Super User
Anonymous , Try below DAX
Average Downtime (Minutes) =DIVIDE(SUMX(VALUES(Source[MESSAGE NUMBER]),CALCULATE(DATEDIFF(MIN(Source[APPEARED]), MIN(Source[DISAPPEARED]), MINUTE) +(SECOND(MIN(Source[DISAPPEARED])) - SECOND(MIN(Source[APPEARED]))) / 60)),COUNTROWS(VALUES(Source[MESSAGE NUMBER]))) - AnonymousNot applicable
Hi, Anonymous
I create a sample table:
Then create a new measure and try the following DAX expression:
AverageDowntime = DIVIDE( SUMX(VALUES('Table'[Message number]), CALCULATE( DATEDIFF(MIN('Table'[APPEARED]), MIN('Table'[DISAPPEARED]), MINUTE) + (SECOND(MIN('Table'[DISAPPEARED])) - SECOND(MIN('Table'[APPEARED]))) / 60 )), DISTINCTCOUNT('Table'[MESSAGE NUMBER]) )Here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.