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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Chrisjab28
Frequent Visitor

Average Sales per Unit per Day

Have anyone found an effective way to calculate the Average per Units per Day in Power BI. 

I tried the following 2 steps approach unsuccessfully: 

  1. Per Unit Average Calculation
    • Average per Unit = AVERAGEX( VALUES ('TABLE NAME'[Units), [Total Sales])
  2. Per Unit per Day Calculation
    • Average per Unit per Day = AVERAGEX( VALUES ('TABLE NAME'[Days]), [Avg per Unit])

Chrisjab28_0-1670864352617.png

 

      

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @Chrisjab28 

According to your description, you calculate the average of different logics and look like a measure.
The calculation of the measure is directly related to the field you put above the visual. We cann see that you are using the  VALUES() function, which will only get the value of your current row. If you want to filter the entire table with the same Unit, you need to replace your function and use the FILTER() and ALLSELECTED() functions to find the value you need to average.

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

6 REPLIES 6
v-yueyunzh-msft
Community Support
Community Support

Hi , @Chrisjab28 

According to your description, you calculate the average of different logics and look like a measure.
The calculation of the measure is directly related to the field you put above the visual. We cann see that you are using the  VALUES() function, which will only get the value of your current row. If you want to filter the entire table with the same Unit, you need to replace your function and use the FILTER() and ALLSELECTED() functions to find the value you need to average.

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Chrisjab28
Frequent Visitor

Thank you @tamerj1 for some reason the resulting average is not accurate. 

If I use the following formula:

Avg per Unit per day = ([Sales]/[Units]))/[Days], I am getting the right average per item; however the overall is still not accurate. 

 

@Chrisjab28 

Please try

 

= 
AVERAGEX ( 'TABLE NAME',  ( [Sales] / [Units] ) / [Days] )

 

Chrisjab28
Frequent Visitor

Hello @tamerj1 - Thank you for your reply. I did try this formula; however, it did not work.

 

@Chrisjab28 

This is basically the same as youtr formula but using one measure 

Average per Unit per day =
AVERAGEX (
VALUES ( 'TABLE NAME'[Days] ),
CALCULATE ( AVERAGEX ( VALUES ( 'TABLE NAME'[Units] ), [Total Sales] ) )
)

tamerj1
Super User
Super User

Hi @Chrisjab28 

you may try 

Average per Unit per day =
AVERAGEX (
SUMMARIZE ( 'TABLE NAME', 'TABLE NAME'[Units], 'TABLE NAME'[Days] ),
[Total Sales]
)

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors