Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in BI by (11.1k points)
I am having a dataset and trying to calculate the difference between Start DateTime and End DateTime and then Average

So how can I do this?

1 Answer

0 votes
by (22.5k points)

Use this particular Calculated field

duration_average = 

VAR total_second = 
AVERAGEX(
    your_table_name,
    DATEDIFF(your_table_name[Start DateTime],your_table_name[End DateTime],SECOND)
)

VAR DAXDay   =  INT(total_second/(24*60*60))
VAR DAXHours =  MOD(INT(total_second/(60*60)),24)
VAR DAXMin   =  MOD(INT(total_second/60),60)
VAR DAXSec   =  MOD(total_second,60)

RETURN DAXDay &" Day "& DAXHours &" Hour "& DAXMin &" Minute "& DAXSec &" Second"

If you want to learn more about Power BI, then read the Power BI Tutorial. Also, enroll in Power BI course online to become proficient in this BI tool.

Related questions

0 votes
1 answer
asked Feb 28, 2021 in BI by Chris (11.1k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...