Forum Discussion
ggzmorsh
Helper II
7 years agoAverage of total values between dates
I have a table where it displays date values from a slicer and their total amounts. I used a measure to calculate the average of those totals between the date selected. Instead it is giving me the ...
- 7 years ago
Hi ggzmorsh ,
If I understand your requirement correctly that you want to calculate the average for the selected date range.
If so, please refer to the measures below.
interval days = VAR maxday = MAX ( 'Table'[Date] ) VAR minday = MIN ( 'Table'[Date] ) RETURN DATEDIFF ( minday, maxday, DAY ) + 1 Average = VAR total = CALCULATE ( SUM ( 'Table'[Value] ), ALLSELECTED ( 'Table' ) ) RETURN DIVIDE ( total, [interval days] )Here is the output.
More details, you also could refer to my attachement.
If you still need help, please share your desired output so that we could help further on it.
Best Regards,
Cherry
v-piga-msft
Resident Rockstar
7 years agoHi ggzmorsh ,
If I understand your requirement correctly that you want to calculate the average for the selected date range.
If so, please refer to the measures below.
interval days =
VAR maxday =
MAX ( 'Table'[Date] )
VAR minday =
MIN ( 'Table'[Date] )
RETURN
DATEDIFF ( minday, maxday, DAY ) + 1
Average =
VAR total =
CALCULATE ( SUM ( 'Table'[Value] ), ALLSELECTED ( 'Table' ) )
RETURN
DIVIDE ( total, [interval days] )
Here is the output.
More details, you also could refer to my attachement.
If you still need help, please share your desired output so that we could help further on it.
Best Regards,
Cherry
- ggzmorsh7 years ago
Helper II
Worked perfectly. Thanks!