Forum Discussion
Average YTD Calculation Based on User Selection
- 6 years ago
Hi PowerBI-Newbie ,
How about this:
Average Planned YTD = VAR SelectedPeriod = SELECTEDVALUE ( 'Table'[Period] ) VAR MaxPeriod = MAX ( 'Table'[Period] ) RETURN IF ( SelectedPeriod = BLANK (), [Planned (YTD)] / MaxPeriod, [Planned (YTD)] / SelectedPeriod )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi PowerBI-Newbie ,
Try this:
Average Planned YTD = CALCULATE ( AVERAGE ( 'Table'[Planned] ), ALLSELECTED ( 'Table'[Period] ) )
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your response Icey but I need the user to select only one period at a time from the slicer and when they do then the correct value is displayed. If they select more than one then the correct averages are displayed for each period. Your images show the incorrect YTD averages for other periods when more than one selection is made - in your example, when you select more than one period the average is displaying the same.
If you look at my table in my post, the user selects only Period 1, average YTD 9 is displayed. User selects only Period 2 then 12.5 is displayed. If user selects Period 1 and 2 then 9 is displayed for Period 1 and 12.5 for Period 2.
I hope that makes sense.
- Icey6 years agoCommunity Support
Hi PowerBI-Newbie ,
How about this:
Average Planned YTD = VAR SelectedPeriod = SELECTEDVALUE ( 'Table'[Period] ) VAR MaxPeriod = MAX ( 'Table'[Period] ) RETURN IF ( SelectedPeriod = BLANK (), [Planned (YTD)] / MaxPeriod, [Planned (YTD)] / SelectedPeriod )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- PowerBI-Newbie6 years agoHelper IV
Hi Icey ,
Thank you for your response. Your solution worked for a lot of my KPIs apart from one. The data is as follows:
Period Area Allocation 1 A 195.03 1 B 266.81 2 A 201.86 2 B 269.18 3 A 200.23 3 B 259.54 I'm calculating the sum of Areas A & B but subtract 26.5 so total for:
- Period 1 is 435.34
- Period 2 is 444.54
- Period 3 is 433.27
The averages should then read:
- Period 1=435.34
- Period 2=439.94
- Period 3=437.72
My Periodic Measure is:
Allocation (FTE) = (sum(Budget_Actuals_Demand_Allocation[Allocation (FTE)-Pre]) - 26.5)For Period 1 I'm getting:But Period 2 produces the following:Many thanks for your help thus far.- Icey6 years agoCommunity Support
What do the numbers in the screenshots you provide represent? And how is it calculated?
Best Regards,
Icey