Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Average Per Year vs. Per Quarter

I am trying to determine the Average Per Year vs. Average Per Quarter. The problem that I am having is that both values are coming out to the same value, which is obviously incorrect because the total number of hours each quarter is 2190. Pretty sure the problem is that I am not considering the blank values and my DAX formula is incorrect. How would you approach this? 

 

Current Value Output -> Avg Per Year = 1,783 / Avg Per Qtr = 1,783

 

Current DAX formula (Avg Per Year) = AVERAGEX( VALUES( Calendar[Date].[Year] ), CALCULATE( SUM( [TotalValues] )))

 

Current DAX formula (Avg Per Qtr) = AVERAGEX( VALUES( Calendar[Date].[QuarterNo] ), CALCULATE( SUM( [TotalValues] )))

 

 2016201720182019TOTAL
Qtr 2140.632858.012938.06493.396430.09
Qtr 1 799.582812.22281.755893.53
Qtr 466.261972.982534.95 4574.19
Qtr 3456.11708.252333.74 4498.09
TOTAL662.997338.8210618.952775.1421395.9

3 Replies

  • Michiel's avatar
    Michiel
    Icon for Resolver III rankResolver III

    Well, obviously both answers are incorrect: for average per year I'd expect 21395/4, for average per quarter I'd expect either 21395/16 or 21395/13, depending on whether or not you want to count empty quarters. Neither of these result in 1783.

    I see one error in your calculation for quarter, as VALUES(Calendar[Date].[QuarterNo]) will be not more than 4 rows.

    The approach would be to break down your calculation: does SUM([TotalValues]) return 21395? What does COUNTROWS(VALUES(Calendar[Date].[Year]))? Etc. My suspicion is that there something going on in your [TotalValues] (measure? column?)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Michiel  thank you for your response. I did not mention that the resulting output was for 3 customers. 

       

      EX: Avg Per Year for 3 Customers = 21,395.89 / 4yrs = 5,348.97 -> 5,348.97 / 3customers = 1,782.99 (1,783)

      • Michiel's avatar
        Michiel
        Icon for Resolver III rankResolver III

        OK, then the problem is indeed in the count of quarters. You need to divide by the number of quarters/years, not quarter numbers. The easiest way to do this is to have a column 'Year-Quarter' in your Calendar table, and use that.