Forum Discussion
Maximum Time in mins based on date range from slicer
- 4 years ago
StephenK2022
Yes becuase DATEDIFF return 0 for the same date difference. Please tryLogged mins vs total mins (Total Accounted for Mins minus Average of TOTAL MINUTES) = VAR FirstDateInFilter = MINX ( ALLSELECTED ( '24hr production report'[Dates] ), '24hr production report'[Dates] ) VAR LastDateInFilter = MAXX ( ALLSELECTED ( '24hr production report'[Dates] ), '24hr production report'[Dates] ) VAR TotalMinutes = DATEDIFF ( FirstDateInFilter, LastDateInFilter + 1, MINUTE ) VAR AccountedMinutes = SUM ( '24hr production report'[Total Accounted for Mins] ) RETURN ABS ( TotalMinutes - AccountedMinutes )
Hi tamerj1 ,
Thanks for your reply,
I am using a measure to work out the unaccounted for mins, the problem is that i am using a column with only 1440 in it. So when I change the date I need a function which will change the value to the maximum minutes over that time period - Basically all the bars in the chart should add up to the total minutes over that time period and all should be the exact same height.
Is the date slicer from the same table?
- StephenK20224 years agoFrequent Visitor
- tamerj14 years ago
Community Champion
Ok Please try
Logged mins vs total mins (Total Accounted for Mins minus Average of TOTAL MINUTES) = VAR FirstDateInFilter = MINX ( ALLSELECTED ( '24hr production report'[Dates] ), '24hr production report'[Dates] ) VAR LastDateInFilter = MAXX ( ALLSELECTED ( '24hr production report'[Dates] ), '24hr production report'[Dates] ) VAR TotalMinutes = DATEDIFF ( FirstDateInFilter, LastDateInFilter, MINUTE ) VAR AccountedMinutes = SUM ( '24hr production report'[Total Accounted for Mins] ) RETURN ABS ( TotalMinutes - AccountedMinutes )- StephenK20224 years agoFrequent Visitor
Thanks very much, this worked for date ranges over 2 days, however now when we look over one day we are getting this:
Over a longer time period:
I'm guessing it is an issue due to "first date in filter" and "last date in filter" being the same value?
Thanks again