Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
PPerera
New Contributor

Need help to write a WAVG calc using DAX

Hi 

 

Please help me to write this WAVG Price formula using DAX

 

Sum( Price * ABS(MV) ) / Sum( CASE(Price = 0 , 0 ,ABS(MV) )

 

Assume Price and MV come from table "Sales"

 

Thanks

1 ACCEPTED SOLUTION
Irwan
Valued Contributor II

hello @PPerera 

 

maybe something like this (not sure if this works since i dont test this DAX).

DIVIDE(
   SUMX(

      'Sales',

      'Sales'[Price]*ABS('Sales'[MV])
   ),

   SUMX(

      FILTER(

         'Sales',

         'Sales'[Price]>0
      ),

      ABS('Sales'[MV])
   )
)

 

Hope this will help.

Thank you.

View solution in original post

3 REPLIES 3
Irwan
Valued Contributor II

hello @PPerera 

 

maybe something like this (not sure if this works since i dont test this DAX).

DIVIDE(
   SUMX(

      'Sales',

      'Sales'[Price]*ABS('Sales'[MV])
   ),

   SUMX(

      FILTER(

         'Sales',

         'Sales'[Price]>0
      ),

      ABS('Sales'[MV])
   )
)

 

Hope this will help.

Thank you.

PPerera
New Contributor

Thank you very much Irwan. It worked. This forum is full of great experts. This was my second question and got the answer almost immediately. Thanks again.

Irwan
Valued Contributor II

hello @PPerera 

 

glad to be a help.

Thank you.

Helpful resources

Announcements
Users online (10,084)