Forum Discussion

puj831's avatar
puj831
Frequent Visitor
8 years ago
Solved

Calculating Averages with conditions

How can I take the average of Price with the condition that Volume > 0?

  • Maby Its depends of your Culture, try to use [  ,  ] instead of  [  ;  ] and try to count your 

  • popov's avatar
    popov
    8 years ago

    Try this
    AveragePrice := AVERAGEX (FILTER(YourTableName, YourTableName[Volume] > 0), YourTableName[Price])

    or this

     

     AveragePrice := CALCULATE ( AVERAGE (YourTableName[Price] ), YourTableName[Volume] > 0 )

5 Replies

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

    Hello, puj831

    Try this
    AveragePrice := AVERAGEX (FILTER(YourTableName; YourTableName[Volume] > 0); YourTableName[Price])

    or this

     

     AveragePrice := CALCULATE ( AVERAGE (YourTableName[Price] ); YourTableName[Volume] > 0 )

    • puj831's avatar
      puj831
      Frequent Visitor

      This is error I keep getting back. Any solutions? Thank you so much!

      • Claster's avatar
        Claster
        Icon for Advocate II rankAdvocate II

        Maby Its depends of your Culture, try to use [  ,  ] instead of  [  ;  ] and try to count your