Forum Discussion

AV_04's avatar
AV_04
Helper I
3 years ago

DAX Help

 Hi guys,

 

Requesting your help for a DAX command. PFB the sample tables:

 

Category  Dist         Value

A0200
B100300
C0400
D300500
E0100
F400300

 

Category    Dist        Value

A0200
B0300
C0400
D0500
E0100
F0300

 

From the above two tables, I need to find the average of Dist - average of values where dist should not be zero. For example, from the first table the average of dist comes to be 266.66(neglecting zeros) and average of Value- 300, for the second table, the avg of dist-0 and average of value is 300, Can anyone help me with the dax formula. I used the below formula but it filtered some records.

 

Calculate((average(dist))- (average(value)), filter(table1,table1[dist]<>0)),

 

the above formula filters the values records also. appreciate if anyone can help me with this requirement.

 

Thank you!

2 Replies

    • tamerj1's avatar
      tamerj1
      Community Champion

      HI AV_04 
      Please try

      =
      CALCULATE ( AVERAGE ( 'Table'[dist] ), 'Table'[dist] <> 0 )
          - AVERAGE ( 'Table'[Value] )