Forum Discussion

taurius2022's avatar
taurius2022
Frequent Visitor
4 years ago
Solved

Summarize average for unique vaalue for every month

Hello community,

 

I have encountered a following problem. Neitheer reading an extensive Power BI forum, nor YouTubing helps.

 

I have the following data set:

 

 

First, I would like to calculate the average count of Unique-ID for the month. 

So that I can click build the line chart, e.g., and see: "ok, for 01/2021, we had on average 11 unique events" (Logic is: count the sum of events for every unique-ID and divide it by the numer of Unique-ID (distinct, I think)).

 

Another issue is to calculate the average sum for a month based on the number of unique-id. The question to be answered is: "for month 01/2021, the average sum based on the sum of Unique-IDs was 7".

 

Thank you in advance.

Bohdan

  • Hi taurius2022 ,

     

    average count of Unique-ID for the month:

    =

    var _s = SUMMARIZE('Table',[Month],[Unique-ID],"sum of events",SUM('Table'[SUM]))
    return
    AVERAGEX(_s,[sum of events])
     
     
    average sum for a month based on the number of unique-id:
    AVERAGE('Table'[SUM])

     

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

1 Reply

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Icon for Community Support rankCommunity Support

    Hi taurius2022 ,

     

    average count of Unique-ID for the month:

    =

    var _s = SUMMARIZE('Table',[Month],[Unique-ID],"sum of events",SUM('Table'[SUM]))
    return
    AVERAGEX(_s,[sum of events])
     
     
    average sum for a month based on the number of unique-id:
    AVERAGE('Table'[SUM])

     

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.