Forum Discussion

skfinegan's avatar
skfinegan
Regular Visitor
6 years ago
Solved

Multiple IF conditions with averageX

I currently have the following IF statement to calculate the avg of the previous day's data if greater than 0.4. However, now I need to add a high limit of 2. So really I want it to take the avg of a...
  • Anonymous's avatar
    Anonymous
    6 years ago

    skfinegan 

    You cannot use if statement as the expression. To get the average between of all values between 0.4 and 2, try add the conditions in the filters: 

     

    CALCULATE(AVERAGE('Kw/ton'[Chiller7_KW_Ton_value (kW)]),FILTER('Kw/ton','Kw/ton'[Chiller7_KW_Ton_value (kW)]>0.4 && 'Kw/ton'[Chiller7_KW_Ton_value (kW)]< 2),FILTER('Kw/ton','Kw/ton'[Date]= EARLIER('Kw/ton'[Date])))

     

     

     

     

    Paul Zheng