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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
jackj
Helper I
Helper I

Dynamic Standard Deviation

Hi,

 

I have a data table with the following attributes:

 

CountryEnd of WeekTotal Sales
US1/1/2022100
Canada1/1/2022150
France1/1/202275
US1/8/202240
Canada1/8/2022150
France1/8/202260
US1/8/202290
Canada1/15/202280
US1/15/202290
France1/15/2022100

 

I would like to be able to create a measure for standard deviation of the 'Total Sales' column that changes dynamically if I adjust the date range or country in a visual.  How can I do this?  

 

Thanks for your help and suggestions!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jackj ,

Please try below steps:

1. create a measure with below dax formula

Standard Deviation of the Total Sales =
VAR cur_country =
    SELECTEDVALUE ( 'Table'[Country] )
VAR max_date =
    MAXX ( 'Table', [End of Week] )
VAR min_date =
    MINX ( 'Table', [End of Week] )
VAR tmp =
    FILTER (
        ALL ( 'Table' ),
        'Table'[Country] = cur_country
            && 'Table'[End of Week] >= min_date
            && 'Table'[End of Week] <= max_date
    )
RETURN
    CALCULATE ( STDEV.P ( 'Table'[Total Sales] ), tmp )

 2. add some visuals like below

vbinbinyumsft_0-1673848295188.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

1 REPLY 1
Anonymous
Not applicable

Hi @jackj ,

Please try below steps:

1. create a measure with below dax formula

Standard Deviation of the Total Sales =
VAR cur_country =
    SELECTEDVALUE ( 'Table'[Country] )
VAR max_date =
    MAXX ( 'Table', [End of Week] )
VAR min_date =
    MINX ( 'Table', [End of Week] )
VAR tmp =
    FILTER (
        ALL ( 'Table' ),
        'Table'[Country] = cur_country
            && 'Table'[End of Week] >= min_date
            && 'Table'[End of Week] <= max_date
    )
RETURN
    CALCULATE ( STDEV.P ( 'Table'[Total Sales] ), tmp )

 2. add some visuals like below

vbinbinyumsft_0-1673848295188.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.