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
Anonymous
Not applicable

standard deviation per category per year

Hello,

 

This is in continuation to previous question about calculating average per category per year. That went well. 

But now i'm stuck at calculating standard deviation per category per year. 

 

so here is the detail of the data. 

I have data where i need to calculate the standard deviation of units per category (apo key+ material key make a unique category for my data) per year (which in my case is observed as previous year (PY), current year (CY) and new year (NY) and is available in the column 'is year')

 

now i have calculated the avergae using the formula- 

Average =
CALCULATE (AVERAGE (tab[units] ),
FILTER ('tab', 'tab'[Material - Key]=EARLIER( 'tab'[Material - Key]) && 'tab'[ISYEAR]=EARLIER('tab'[ISYEAR]) && 'tab'[APO Key]= EARLIER('tab'[APO Key]))
)
 
and now need to calculate standard deviation. The STDEV.X uses the formula sqrt(sum(X-Xavg)^2/n) but my n has to change per cateory per year and so i cannot apply this straightaway. 
 
Is using STDEVX.P a better approach? if so, then what would be the expression that i must supply to the formula.
 
Or should i break down the formula into columns and the calculate 'n' seperately? in that case, how should i calculate 'n'?
 
Essentially the column in the green is what i want to obtain. 
 
Thank you 🙂
sd sample.PNG
1 REPLY 1
Stachu
Community Champion
Community Champion

Hi, can you paste that data in the copiable table format as below?

Column1 Column2
A 1
B 2.5

Then I could work on the formula in PowerBI



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.