Forum Discussion
averagex
- 9 years ago
Hi, Try this please:
1. Create a measure to count the days between the range selected in Date Slicer (Plus 1)
DayBetweenFirst&LastDaySelected+1 = DATEDIFF ( MIN ( AirCraft[Date] ), MAX ( AirCraft[Date] ), DAY ) + 1
2. Create a measure to calculate the Average Daily Hour
AverageDailyHour = DIVIDE ( SUM ( AirCraft[Hours] ), [DayBetweenFirst&LastDaySelected+1] )
Can you post the results you are expecting?
Does this get you what you want?
Average Per Day MEASURE =
DIVIDE (
CALCULATE (
SUM ( 'Table'[Hours] ),
ALLEXCEPT ( 'Table', 'Table'[Date], 'Table'[Aircraft] )
),
CALCULATE (
COUNTROWS ( 'Table' ),
ALLEXCEPT ( 'Table', 'Table'[Date], 'Table'[Aircraft] )
),
0
)
- wrwillits9 years agoHelper III
The result I'm trying to get to is:
Row Labels 1/1/2016 1/2/2016 1/3/2016 1/4/2016 1/5/2016 1/6/2016 1/7/2016 Grand Total Average N111PD 6 8 0 12 0 0 11 37 5.29 The objective is to total the number of hours per day and then average the number of daily hours per period (the MIN and MAX that the user selects). For this example the MIN is 1/1/2016 and the MAX is 1/7/2016. The days where there are no hours flown there actually isn't any data in the aircraft's utilization table (dates 1/3/2016, 1/5/2016 and 1/6/2016 in this example). So in order to address this what I have done is created a calendar table and associated it with the aircraft's utilization table to include the dates where there are no hours flown. That then adds the all the dates, but then the days with no hours flown are blank in the "Hours" column.
- wrwillits9 years agoHelper III
Here's an actual visual of the PowerBI dashboard that I'm developing:
Obviously I am working with much more detailed data than what I presented as the example. You can see at the top the user can use the date scroller to identify the specific dates he wants to review (MIN and MAX). The data then refreshes with the new utilization charts (hours and cycles), and the hourly and cyclic daily averages are supposed to show up in the cards to the right.
- Vvelarde9 years agoCommunity Champion
Hi, Try this please:
1. Create a measure to count the days between the range selected in Date Slicer (Plus 1)
DayBetweenFirst&LastDaySelected+1 = DATEDIFF ( MIN ( AirCraft[Date] ), MAX ( AirCraft[Date] ), DAY ) + 1
2. Create a measure to calculate the Average Daily Hour
AverageDailyHour = DIVIDE ( SUM ( AirCraft[Hours] ), [DayBetweenFirst&LastDaySelected+1] )