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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Standard Deviation and Average of Count of Occurrences

I am currently building a PowerBI to display how many pumps of a product you get out of a certain bottle of product. Many replicates are being done to determine the variation in number of pumps per bottle. I have time stamps for each occurance and an index value for which bottle these pumps are made on. I want to the average and standard deviation of the total number of pumps per bottle. There will be 100+ bottles, so I don't want to have to write 100+ measures for each bottle. Any ideas of how to write a measure so I can display the updated average and standard deviation as more and more data comes in? I put an example of the data set I have below. Thank you for your help!

 

Date TimePumpBottle Index
7/30/2020 6:0815
7/30/2020 6:0915
7/30/2020 6:1115
7/30/2020 6:1415
7/30/2020 6:1515
7/30/2020 6:1615
7/30/2020 6:1815
7/30/2020 6:1915
7/30/2020 6:2015
7/30/2020 6:2215
7/30/2020 6:2316
7/30/2020 6:2416
7/30/2020 6:2616
7/30/2020 6:2716
7/30/2020 6:2816
7/30/2020 6:3016
7/30/2020 6:3116
7/30/2020 6:3216
7/30/2020 6:3416
7/30/2020 6:3516
7/30/2020 6:3616
7/30/2020 6:3816
7/30/2020 6:3916
7/30/2020 6:4017
7/30/2020 6:4117
7/30/2020 6:4317
7/30/2020 6:4417
7/30/2020 6:4517
7/30/2020 6:4717
7/30/2020 6:4817
7/30/2020 6:4917
7/30/2020 6:5117
7/30/2020 6:5217
7/30/2020 6:5318
7/30/2020 6:5518
7/30/2020 6:5618
7/30/2020 6:5718
7/30/2020 6:5918
7/30/2020 7:0018
7/30/2020 7:0118
7/30/2020 7:0318
7/30/2020 7:0418
7/30/2020 7:0518
1 ACCEPTED SOLUTION
Anonymous
Not applicable

[Avg Across Bottles] =
    AVERAGEX(
        VALUES( T[Bottle Index] ),
        CALCULATE(
            SUM( T[Pump] )
        )
    )
    
[Std Across Bottles] =
    STDEVX.S(
        VALUES( T[Bottle Index] ),
        CALCULATE(
            SUM( T[Pump] )
        )        
    )

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

[Avg Across Bottles] =
    AVERAGEX(
        VALUES( T[Bottle Index] ),
        CALCULATE(
            SUM( T[Pump] )
        )
    )
    
[Std Across Bottles] =
    STDEVX.S(
        VALUES( T[Bottle Index] ),
        CALCULATE(
            SUM( T[Pump] )
        )        
    )
Anonymous
Not applicable

That worked, thank you!!!

Anonymous
Not applicable

[Avg] = AVERAGE( T[Pump] )
[Std] = STDEV.S( T[Pump] )

// All you have to do now is
// slice by Bottle Index to
// get the avg and std of
// the total number of pumps
// per bottle.
Anonymous
Not applicable

If I use:

 

 

[Avg] = AVERAGE( T[Pump] )
[Std] = STDEV.S( T[Pump] )

 

 

It produces an Avg = 1, and Std = 0. All pump values are 1 in my table. I want to do the average and std based on the sum of "1"s from each bottle index value (5-8 in my example). The answer should be:

 

Average = 10.75

Std.S = 1.5

 

Which comes from:

 

IndexBottle Pumps
510
613
710
810

 

I need a way to somehow transform my data into table like this within PowerBI and then calculate average and standard deviation from this new table. 

Anonymous
Not applicable

I couldn't find anything in those links to help with my application. If you have any specific advice or code that would help with my problem listed above would be helpful, thanks!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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