Forum Discussion

jeremy-b's avatar
jeremy-b
Regular Visitor
4 years ago

Average and standard deviation

Hi everyone,

I would like to calculate a 2-year average and standard deviation with the following information:

 

DivisionNotificationCreated on
A0045828702/01/2020
B0045828802/01/2020
A0045828903/01/2020
B0045829003/01/2020
B0045829103/02/2020
A0045829203/02/2020
B0045829303/03/2020
C0045829403/05/2020
B0045829504/05/2020
C0045829605/05/2020
C0045829706/06/2020
A0045829806/06/2020
A0045829906/06/2020
C0045830006/07/2020
C0045830107/07/2021
C0045830231/01/2021
C0045830331/01/2021
C0045830431/01/2021
B0045830502/02/2021
C0045830602/02/2021
B0045830702/02/2021
A0045830802/02/2021
B0045830916/03/2021
A0045831016/03/2021
A0045831116/03/2021
C0045831216/03/2021
A0045831316/03/2021
B0045831408/04/2021
A0045831509/04/2021
C0045831609/04/2021
B0045831709/04/2021

With a dynamic pivot table I can do it but I want to do it in Power BI.

thank you for your help.

4 Replies

  • jeremy-b , If you need each row consider 12 months you can have measure like

     

    Rolling 12 = CALCULATE(Average(Table[valuet]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

     

    I do not see any value column, avg of ?

    • jeremy-b's avatar
      jeremy-b
      Regular Visitor

      Hi, amitchandak 

      thank you for your help.

       

      to answer your question, I don't have any values because I need to first count the number of "notifications" per month and then calculate the average of this number.

       

      I need to calculate the average per line (e.g: 2020 and 2021)

       

       

      • amitchandak's avatar
        amitchandak
        Super User

        jeremy-b , For Avg of Count/Sum

         

        A measure like

         

        averageX(Values('Date'[Month Year]), calculate(count(Table[Value])) )

         

        This will work for Sub total and GT

         

        Each row year wise Avg

        averageX(Values('Date'[Month Year]), calculate(count(Table[Value])) )

         

        This Year = CALCULATE(averageX(Values('Date'[Month Year]), calculate(count(Table[Value])) ),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))

         

        Last Year = CALCULATE(averageX(Values('Date'[Month Year]), calculate(count(Table[Value])) ),filter(ALL('Date'),'Date'[Year]=max('Date'[Year]) -1 ))