This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi Guys,
I have troulbe with calculating average execluting ZEROS. I have the below code which calculating me the average but is including ZEROS. Where to add <>0 in the below to exclude ZEROS please?
_Landed Ave Product Unit Cost 2019 ALL() =
CALCULATE ( AVERAGEX ( VALUES ( 'Transaction History2019 2020'[Item Number] ), [_Average Landed Unit Cost 2019] ),
ALL ( 'Calendar'[Date] ),
ALL ( 'Transaction History2019 2020'[Number] ), 'Calendar'[Year] = "2019" )
in case this is important the [_Average Landed Unit Cost 2019] is a measure. See below:
So PBI is calculating 0.467+0.442048835+0.442+0.442 = 1.793048835 / 20 =0.08965
and the average should be 1.793048835/4=0.44826220875
PLEASE HELP!
Thnaks!
Solved! Go to Solution.
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"
)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting@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...
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"
)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingTHANK 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!
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 26 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 68 | |
| 37 | |
| 32 | |
| 25 | |
| 23 |