Forum Discussion
Average witout ZERO
- 6 years ago
This is the corrected measure. Always format the DAX. Makes it easy to see where parenthesis are missing BigTommy
Measure = CALCULATE( AVERAGEX( FILTER( VALUES( 'Transaction History2019 2020'[Item Number] ), [_Average Landed Unit Cost 2019] > 0 ), [_Average Landed Unit Cost 2019] ), ALL( 'Calendar'[Date] ), ALL( 'Transaction History2019 2020'[Number] ), 'Calendar'[Year] = "2019" )
BigTommy , Try
CALCULATE ( AVERAGEX ( filter(VALUES ( 'Transaction History2019 2020'[Item Number] , [_Average Landed Unit Cost 2019] >0), [_Average Landed Unit Cost 2019] ),
ALL ( 'Calendar'[Date] ),
ALL ( 'Transaction History2019 2020'[Number] ), 'Calendar'[Year] = "2019" )
or
AVERAGEX (filter( summarize('Transaction History2019 2020', 'Transaction History2019 2020'[Item Number],"_1",CALCULATE ( AVERAGEX ( VALUES ( 'Transaction History2019 2020'[Item Number] ), [_Average Landed Unit Cost 2019] ),ALL ( 'Calendar'[Date] ),ALL ( 'Transaction History2019 2020'[Number] ), 'Calendar'[Year] = "2019" ) ),[_1]>0),[_1])
Hello sir,
I have entered the code buit the last part (line4) has some errors...
- edhans6 years agoCommunity Champion
This is the corrected measure. Always format the DAX. Makes it easy to see where parenthesis are missing BigTommy
Measure = CALCULATE( AVERAGEX( FILTER( VALUES( 'Transaction History2019 2020'[Item Number] ), [_Average Landed Unit Cost 2019] > 0 ), [_Average Landed Unit Cost 2019] ), ALL( 'Calendar'[Date] ), ALL( 'Transaction History2019 2020'[Number] ), 'Calendar'[Year] = "2019" )- BigTommy6 years agoHelper I
THANK YOU!
This make sense now.
I have also tested another solution which replacing ZEROS with NULL in power query... also works!
thank you and have great week!