Forum Discussion

mtrevisiol's avatar
mtrevisiol
Icon for Helper V rankHelper V
4 years ago
Solved

Monthly average of average quantity

Hi everyone.

I've got this table:

that represents the sales of two months (august and september), the time (hour) when the sale took place (in different days of the month), the quantity sold and the name of the product sold.

I've represented in a bar chart the average quantity sold for each hour (from 8 to 18) for each month, which can be selected through a slicer:

 

My intent is to calculate the "average of the averages" of the quantities sold in each hour. According to the figure the calculation would be

(20+12+24+45+36,33+100+28,5+40,5+17+1)/10 = 32,43

 

Here is a PBIX file containing the data: https://www.dropbox.com/s/l44cnr2ut689ryp/Average%20per%20hour.pbix?dl=0

 

Many thanks!

  • Hi mtrevisiol ,
    Check if the measure Media di Media di Qty per Mese is working fine and is there any difference in the table structure between your dummy file and the actual table ?

     

    Regards,

    Jaideep

4 Replies

  • Hi mtrevisiol ,
    Create a measure like this:

    Average Value = 

    var num=SUMX(DISTINCT('Table'[Hour]),[Media di Media di Qty per Mese])

    var den=DISTINCTCOUNTNOBLANK('Table'[Hour])

    var calc= DIVIDE(num,den,BLANK())

    return calc
     
    this will give you the desired output:

    Please accept this as a solution if your question has been answered !!

    Appreciate a Kudos 😀

    • mtrevisiol's avatar
      mtrevisiol
      Icon for Helper V rankHelper V

      Thanks jaideepnema , the measure works perfectly in this dummy file, but I don't know why in my real file the numerator is incorrect (I get a sum that is lower than the real one), while the denominator is ok. Do you have any idea what the problem might be?

      • jaideepnema's avatar
        jaideepnema
        Icon for Solution Sage rankSolution Sage

        Hi mtrevisiol ,
        Check if the measure Media di Media di Qty per Mese is working fine and is there any difference in the table structure between your dummy file and the actual table ?

         

        Regards,

        Jaideep