Time sum showing incorrect

Used for anything related to the new Power BI Desktop and Service tools
User avatar
AndVGri
Posts: 18
Joined: Thu Jun 02, 2016 2:41 am
Location: Sankt-Peterburg

Time sum showing incorrect

Postby AndVGri » Wed Mar 01, 2017 11:03 pm

Hi
I have a measure which is a sum of all time calls per user. But If the that sum is more than 24 hours I have a problem with its displaying. I created a long code for solving that.

Code: Select all

Time Calls = Var allTime = Sum('Persons'[Call Time])
Var prefix = IF(DAY(allTime) > 30 || YEAR(allTime) = 1900; FORMAT(DAY(allTime + 2); "DD") & "d "); "")
RETURN IF(ISBLANK(allTime); BLANK(); prefix & FORMAT(allTime; "HH:mm:ss"))

But is there a way without such coding?
Regards, Andrey.

MattAllington
Posts: 818
Joined: Sun May 04, 2014 4:01 pm
Location: Sydney, Australia

Re: Time sum showing incorrect

Postby MattAllington » Thu Mar 02, 2017 8:03 pm

If the total is more than 24 hours, it should give you a date and time I think. If you format the measure as decimal number, it should give you the total decimal days (e.g. 1.25 days). If you times this by 24 it will give you total hours.
Matt Allington is Professional Self Service BI Consultant, Trainer and Author of the book "Learn to Write DAX". You can hire me at http://Exceleratorbi.com.au
http://exceleratorbi.com.au/what-is-power-pivot/
http://xbi.com.au/learndax

User avatar
AndVGri
Posts: 18
Joined: Thu Jun 02, 2016 2:41 am
Location: Sankt-Peterburg

Re: Time sum showing incorrect

Postby AndVGri » Fri Mar 03, 2017 5:07 pm

Thank you, Matt.


Return to “Power BI Desktop/Service”

Who is online

Users browsing this forum: No registered users and 1 guest