Forum Discussion

shaykoooo's avatar
shaykoooo
Icon for Helper I rankHelper I
8 years ago
Solved

Differenr results then expected

Hi,

In sheet "???", I have two measres, Average Quantity Sold per Day = AVERAGEX(VALUES(Dates[Date]),[Total Quantity Sold]) and Average Quantity Sold per Day 2 = AVERAGEX(VALUES(Dates[Date]),SUM(Sales[Quantity])) not returning the same result as I expect. What is the reason for that?

The measue [Total Quantity Sold] is bulit from the expression SUM(Sales[Quantity]) and that's why I assumed it would return the same results...

 

TY

  • shaykoooo

     

     

    You should wrap the sum inside calculate to transform the ROW context into FILTER CONTEXT

     

    Average Quantity Sold per Day 2 =
    AVERAGEX ( VALUES ( Dates[Date] ), CALCULATE ( SUM ( Sales[Quantity] ) ) )

2 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    shaykoooo

     

     

    You should wrap the sum inside calculate to transform the ROW context into FILTER CONTEXT

     

    Average Quantity Sold per Day 2 =
    AVERAGEX ( VALUES ( Dates[Date] ), CALCULATE ( SUM ( Sales[Quantity] ) ) )
    • shaykoooo's avatar
      shaykoooo
      Icon for Helper I rankHelper I
      And in the first measure there is no need to wrap the measure [Total Quantity Sold] there is no need to with CALCULATE since measures have an Implicit CALCULATE?