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

Dynamic standard deviation - DAX

Hey Guys,

 

I have to represent the average and stadand deviation of the Lead Time deliveries in a graph for each supplier and product. And this average and standard deviation would change according to the slicer of the Purchase Order Date.

 

I have this spreadsheet.

Material CodeSupplierPuchase OrderPurchase Order DateLT
AX11111124/09/202040
AX11111224/09/202050
AX1111134/11/202016
AX1111141/12/202034
AX11111524/02/20212
AX11111612/07/202113
AY1111177/12/2020163
AY1111187/12/2020163
AY1111197/12/2020158
AY11112015/12/2020154
AY11112116/05/2021116
BXX11112221/09/202092
BXX1111232/10/202041
BXX1111242/11/202050
BYY11112521/11/202038
BYY11112622/01/202118
BYY1111277/02/202126
BYY11112816/03/202120
BYY11112916/03/202141
BYY1111304/04/202136
BYY11113121/04/202126
BYY11113227/04/202131
BYY11113310/05/20218
BYY1111348/07/202111
BYY1111352/08/202128

 

Basically, I would need a graph like that. 

bcar2000_0-1635136265315.png

 

However, I cannot calculate the standard deviation of each supplier and material code, just the average is working. 

 

I calculated successfully the average by using two formulas:

 

Average_Aux = CALCULATE(AVERAGEX(Table,Table[LT]),ALLEXCEPT(Table,Table[Supplier],Table[Material Code],Table[Purchase Order Date]))
 
Average = AVERAGEX(SUMMARIZE(Table,Table[Supplier],"name",Table[Average_Aux]),[Average_Aux])

 

I tried to reply for the standard deviation P. The first formula has worked, and the I see the standard deviation of the product in the graph. But when I apply the second formula to filter per supplier, the result is zero.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous

 

Create two measures rather than calculated columns with below DAX.

Average = CALCULATE(AVERAGE('Table'[LT]),ALLEXCEPT('Table','Table'[Supplier],'Table'[Material Code],'Table'[Purchase Order Date]))


Standard Deviation = CALCULATE(STDEV.P('Table'[LT]),ALLEXCEPT('Table','Table'[Supplier],'Table'[Material Code],'Table'[Purchase Order Date]))

 

Please refer to the attached PBIX file. When I captured the following screenshot, I put Material Code in the X axis. But later I found it should be Supplier instead, so I replaced the column in the PBIX directly without capturing a new screenshot as the settings are totally the same. 

21102702.jpg

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous

 

Create two measures rather than calculated columns with below DAX.

Average = CALCULATE(AVERAGE('Table'[LT]),ALLEXCEPT('Table','Table'[Supplier],'Table'[Material Code],'Table'[Purchase Order Date]))


Standard Deviation = CALCULATE(STDEV.P('Table'[LT]),ALLEXCEPT('Table','Table'[Supplier],'Table'[Material Code],'Table'[Purchase Order Date]))

 

Please refer to the attached PBIX file. When I captured the following screenshot, I put Material Code in the X axis. But later I found it should be Supplier instead, so I replaced the column in the PBIX directly without capturing a new screenshot as the settings are totally the same. 

21102702.jpg

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

amitchandak
Super User
Super User

@Anonymous , Try like

 

Average = AVERAGEX(values(Table[Supplier]),[Average_Aux])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you for the reply 🙂

 

The average was working, but when I try to replicate to standard deviation:

 

StdDev_Aux = CALCULATE(STDEVX.P(Table,Table[LT]),ALLEXCEPT(Table,Table[Supplier],Table[Material Code],Table[Purchase Order Date])) ----->this one gives me the the standard deviation in the graph, but not per supplier
 
Then I applied your formula and it didn't work
StdDev= STDEVX.P(VALUES(Table[Supplier]),[StdDev_Aux])
 
 

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.

Top Solution Authors