Forum Discussion
RMV
Helper V
7 years agodifferent value when summed up and when filtered
Hi, I have 2 visuals. 1 (at the top visual) is the average trend by period, which can be monthly and drill down by weekly. The other 1 is the average of all period by Category. (I don't know what happened with this web, but unfortunately i cannot attach any file) This is the illustration with data sample Category Name Date Week Value 1 Value 2 A 12/28/2018 2018-52 90 70 A 12/29/2018 2018-52 30 70 A 12/30/2018 2018-52 20 70 A 12/31/2018 2018-53 40 70 A 1/1/2019 2019-01 50 70 A 1/2/2019 2019-01 90 70 A 1/3/2019 2019-01 110 70 A 1/4/2019 2019-01 100 70 B 12/28/2018 2018-52 63 40 B 12/29/2018 2018-52 21 40 B 12/30/2018 2018-52 14 40 B 12/31/2018 2018-53 28 40 B 1/1/2019 2019-01 35 35 B 1/2/2019 2019-01 63 35 B 1/3/2019 2019-01 77 35 B 1/4/2019 2019-01 70 35 C 12/28/2018 2018-52 108 C 12/29/2018 2018-52 36 C 12/30/2018 2018-52 24 C 12/31/2018 2018-53 48 C 1/1/2019 2019-01 60 C 1/2/2019 2019-01 108 C 1/3/2019 2019-01 132 C 1/4/2019 2019-01 120 The result expected When the top visual is filtered for a specific Category, it will need to use Value 2 for calculating average by period, if the Category has Value 2. If not, then the value to be use is Value 1. 1. Visual By Week (when there's a filter with specific Category) Example 1 Filter : Category A The result (in table view): 2018-52 2018-53 2019-01 70 70 70 *average of Value 2 for Category A for each week Example 2 Filter : Category C The result (in table view): 2018-52 2018-53 2019-01 56 48 105 *average of Value 1 for Category A for each week, Value 1 is used when Value 2 is not available 2. Visual By Week (when there's no filter applied) 2018-52 2018-53 2019-01 166 158 253.75 *sum of average figure of each sites by week; the figure is based on which ever greater between average of Value 1 and average of Value 2 in the week This figure is coming from - in week 2018-52 Category A: Average of Value 1 is 46.67, Average of Value 2 is 70. Since 70 is greater than 46.67, then 70 is used for Category A Category B: Average of Value 1 is 32.67, Average of Value 2 is 40. Since 40 is greater than 32.67, then 40 is used for Category B Category C: Average of Value 1 is 56, and since there's no Value 2, then 56 is used for Category C Sum of the average of the 3 Categories = 166 - in week 2018-53 Category A: Average of Value 1 is 40, Average of Value 2 is 70. Since 70 is greater than 40, then 70 is used for Category A Category B: Average of Value 1 is 28, Average of Value 2 is 40. Since 40 is greater than 28, then 40 is used for Category B Category C: Average of Value 1 is 48, and since there's no Value 2, then 48 is used for Category C Sum of the average of the 3 Categories = 158 - in week 2019-01 Category A: Average of Value 1 is 87.5, Average of Value 2 is 70. Since 87.5 is greater than 70, then 87.5 is used for Category A Category B: Average of Value 1 is 61.25, Average of Value 2 is 30. Since 61.25 is greater than 20, then 61.25 is used for Category B Category C: Average of Value 1 is 105, and since there's no Value 2, then 105 is used for Category C Sum of the average of the 3 Categories = 253.75 Need help on how to make this visual possible. Very appreciate the help.
RMV,
You may try the measure below.
Measure = SUMX ( VALUES ( Table1[Category Name] ), CALCULATE ( MAX ( AVERAGE ( Table1[Value 1] ), AVERAGE ( Table1[Value 2] ) ) ) )
1 Reply
- v-chuncz-msft
Community Support
RMV,
You may try the measure below.
Measure = SUMX ( VALUES ( Table1[Category Name] ), CALCULATE ( MAX ( AVERAGE ( Table1[Value 1] ), AVERAGE ( Table1[Value 2] ) ) ) )