Forum Discussion
How to show average hours on graph
Yes! I need to know how!
I tried to put it as duration but it did not work out.
That way that presented in the image is the form that I need.
This is what I did, not added duration but converted time to number. Assuming your tempo field is of datetime type.
- click Add Column
- if DataType of tempo field is datetime then add this formula for custom field -> DateTime.ToText([Tempo], "HH.mm")
- if DataType of tempo field is Time then add this formula for customer field -> Time.ToText([Tempo], "HH.mm")
- Change this new custom field to fdecimal number
Now add this new custom field in your bar graph as value.
Also make sure in above formula, there is dot (.) between HH and mm. Try it.
If you need further help, I can send you pbix file, send me a private message with your email in it.
Thanks,
- MattAllington9 years agoCommunity Champion
Here is a working solution for you. I created a measure that respects the current filter context and displays an average hours line. I had to convert the hours to a decimal number first
here is the sample workbook https://www.dropbox.com/s/v8y46cw5bixolam/average%20hours.pbix?dl=1
Here is my measure
Average = CALCULATE(sum(Data[Decimal Hours])/DISTINCTCOUNT(Data[Date]),filter(all(Data[Date]),Data[Date] >=FIRSTDATE(Data[Date]) && Data[Date] <=LASTDATE(Data[Date])))
Here is the hour conversion (PQFL)
= Table.AddColumn(#"Extracted Time", "Decimal Hours", each Time.Hour([hour]) + Time.Minute([hour])/60)
- tiagotas9 years agoHelper I
I could not do the measurement, can you send me the file?
Or show me how your table is?
- MattAllington9 years agoCommunity Champion
tiagotas wrote:I could not do the measurement, can you send me the file?
Or show me how your table is?
The file is linked in my earlier post.