powerbidaxdata-analysispowerbi-desktopmeasure

Get Average of Top 3 in a Summarized Table in Power Bi


I'm new to Power Bi and I'm facing a problem. I have Sales table in which there is column named Moony. The table is like this:

RowNumber Moony Volume
1 140309 123456
2 140309 15616
3 140210 565
4 140123 51
5 140202 123
6 140011 456
7 140202 123

I want to Group them by Moony and then get the average of top 3 Volumes Order by Moony desc. I tried the summarization of:

SUMMARIZE(Sales,Sales[Moony],"SalesVol",SUM(Sales[Volume]))

What can I try next?


Solution

  • Try this:

     Average of top3 = 
    AVERAGEX(
        TOPN(3,
            SUMMARIZE(Sales,Sales[Moony],"@SalesVol",SUM(Sales[Volume])), 
            [Moony], 
            DESC
            ),
        [@SalesVol]
    )