вы можете создать настраиваемый столбец в своей таблице с помощью этого кода ниже -
category_type_wise_average =
VAR current_category = pie_chart[category]
VAR current_type = pie_chart[type]
VAR category_wise_average =
AVERAGEX(
FILTER(
pie_chart,
pie_chart[category] = current_category
&& pie_chart[type] = current_type
),
pie_chart[amount]
)
RETURN category_wise_average
Теперь у вас будет среднее значение категории и типа в каждой строке, как показано на изображении ниже. Теперь вы можете применить необходимую фильтрацию в соответствии с вашими требованиями.
SOLUTION 2:
Now, if you feel there is performance issue in generation a custom column with average calculation for every row, you can try this below option with same result-
Step-1:
Create a new custom table with this below code-
pie_group_average =
VAR sub_category_wise_total =
GROUPBY (
pie_chart,
pie_chart[category],
pie_chart[type],
"average",AVERAGEX(CURRENTGROUP(), pie_chart[amount])
)
RETURN
SELECTCOLUMNS (
sub_category_wise_total,
"category",pie_chart[category],
"type",pie_chart[type],
"average",[average]
)
Step-2:
Now create a Custom Column in your main table as below-
category_type_wise_average_2 = LOOKUPVALUE(
pie_group_average[average],
pie_group_average[category],pie_chart[category],
pie_group_average[type],pie_chart[type]
)
This measure will now hold the same value we generated in solution-1 with custom column.
Additional Steps:
Step-3:
Please create another custom column as-
show_hide =
IF(
pie_chart[amount] >= pie_chart[category_type_wise_average_2],
1,
0
)
Step-4:
Add these 2 visual level filter as shown in the below image-
Step by step change in data showing will be as below-
введите описание изображения здесь
Надеюсь, это вам поможет!