I am working on the below calculation; I have tried different solutions but not able to get the required output. The sample table looks like below with ID, Amount, Category, Type;
I have a pie chart that shows the split of cash and card. Also, I created a measure to identify the average amount by each category like below.
AverageExpenseType =
AVERAGEX(
SUMMARIZE('Data',
'Data'[Category],
"Total Spent", AVERAGE('Data'[Amount])),
[Total Spent])
What I need to create is a table where the Top 5 ID's amount is more than the average to the respective Category and Type. i.e., when I select Cash in the pie chart, the average needs to calculated based on the cash or card as well.
For eg. the average of category A for cash is 4710 and the output looks like below where the ID having more than the average for Category A and Cash type




