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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Nikhil_bb
New Member

How do I find the average of a all values of a column which is summed by date?

Apologies if the question isn't phrased correctly, I have a table which has session_date and visitor_count.

 

The visitor count is summed for each session date. I would like to find the average + stddev.p and average - stddev.p (which I will call UCL and LCL) of these summed values in a seperate column and populate the same value to each cell.

 

The reason for doing so is that I can plot the UCL and LCL values as a straight lines on the graph as show below in Excel.

 

cap2.PNG

 

However when I try to find the average it gives me the average by each row, as shown below.

 

cap3.PNG

 

Could someone help me on how to go about getting the UCL and LCL plotted on the graph? Thanks in advance! 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Nikhil_bb ,

Sorry for replying late. Based on your description, you can create these measures:

 

avg = 
VAR _sum =
    CALCULATE ( SUM ( 'Table'[vistor count] ), ALL ( 'Table' ) )
VAR _count =
    CALCULATE ( COUNTROWS ( 'Table' ), ALL ( 'Table' ) )
RETURN
    _sum / _count
std dev = CALCULATE(STDEV.P('Table'[vistor count]),ALL('Table'))
UCL = [avg] + [std dev]
LCL = [avg] - [std dev]

 

re.png

Attached a sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

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

2 REPLIES 2
v-yingjl
Community Support
Community Support

Hi @Nikhil_bb ,

Sorry for replying late. Based on your description, you can create these measures:

 

avg = 
VAR _sum =
    CALCULATE ( SUM ( 'Table'[vistor count] ), ALL ( 'Table' ) )
VAR _count =
    CALCULATE ( COUNTROWS ( 'Table' ), ALL ( 'Table' ) )
RETURN
    _sum / _count
std dev = CALCULATE(STDEV.P('Table'[vistor count]),ALL('Table'))
UCL = [avg] + [std dev]
LCL = [avg] - [std dev]

 

re.png

Attached a sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

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

FarhanAhmed
Community Champion
Community Champion

you can try by creating a measure 

 

_VisitorCount = SUM(Table[Visitor Count])

 

_Avg = AVERAGEX(all('Table'[Date]),[_VisitorCount])
 
_Std Dev = CALCULATE(STDEV.P('Table'[Visitor Count]),ALL('Table'[Date]))






Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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