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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Dooriya101
Frequent Visitor

Why my annual average number equals to sum of average number in each month?

Hi All,

 

I'm encountering a calculation issue that I'm trying to have an average number by month using Total case number divide Total PC number. And Total case number divide Total PC number are calculated based on two different sheet, however I have used third sheet and link them together. 

 

And you can see from below screenshot that the average Case by PC = 0.09, and it equals to the sum of each month in the bar chart. I'm wondering if there is anything wrong in my calculation. I' think average number should be a middle number in a fluctuation. Thanks!

 

Dooriya101_0-1675133444378.png

 

 

Raw Data is like: 

PC Number:

Dooriya101_1-1675133709481.png

 

Case Number:

Dooriya101_2-1675133749319.png

 

Thrid Table:

Dooriya101_3-1675133762817.png

 

In PBI:

Total Case Number = COUNT('Case Table'[Case Number])
 
Total VALUE = SUM('Main Table'[Value])
Total PC = CALCULATE('Main Table'[Total VALUE], 'Main Table'[Key Figure] = "PC")
 
Avg Case by PC = [Total Case Number]/[Total PC]
5 REPLIES 5
v-yangliu-msft
Community Support
Community Support

Hi  @Dooriya101 ,

 

Here are the steps you can follow:

1. Create measure.

Avg Case by PC =
var _count=
 COUNTX(
    'Case Number'
,[Case Number ber])
var _sum=
SUMX(
    FILTER(ALLSELECTED('PC Number'),
    'PC Number'[Key Figure]="PC"),[Value])
return
DIVIDE(
    _count,_sum)

2. Result:

vyangliumsft_0-1675217218619.png

 

Best Regards,

Liu Yang

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

Hi Yang,

 

Thanks for you sharing! I tried you DAX in my product enviroment and it did worked out as you stated. But I'm actually seeking the average of each month's average number, so I can use the it to do colour setting for columns, which means I need to manully create a baseline for the monthly average number. Thanks!

Ashish_Mathur
Super User
Super User

Hi,

Share data in a format the can be pasted in an MS Excel file.  Also, show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

I've copied the raw in another issue, and somehow I get the number that I want but not sure if the calculation logic is correct and have another issue in colour settings with some extra calculation. If you still interest, pls check this:

Conditionally Formatting reflects all bars with sa... - Microsoft Power BI Community

 

Thanks!

Hi,

I would not be able to help with this one.  My interest is more around calculations/modelling.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.