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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Uzi2019
Super User
Super User

Standard Deviation

Hi Expert,

Could you please help me to compute STDEV of revenue in DAX? I am attaching below data along with how it's working in exce

datesourcechannelrevenueExpected Output SDSD Formula
1/1/2022AABC100  
1/2/2022AABC1032.121320344=STDEV.S(D2:D3)
1/3/2022AABC1083.535533906=STDEV.S(D3:D4)
1/4/2022AABC928579.8275606=STDEV.S(D4:D5)
1/5/2022AABC283456.0838739=STDEV.S(D5:D6)
1/1/2022AABC100  
1/2/2022AABC20070.71067812=STDEV.S(D7:D8)
1/3/2022AABC30070.71067812=STDEV.S(D8:D9)
1/4/2022AABC20269.29646456=STDEV.S(D9:D10)
1/5/2022AABC2052.121320344=STDEV.S(D10:D11)
1/1/2022BXYZ100  
1/2/2022BXYZ300141.4213562=STDEV.S(D12:D13)
1/3/2022BXYZ3032.121320344=STDEV.S(D13:D14)
1/4/2022BXYZ3051.414213562=STDEV.S(D14:D15)
1/5/2022BXYZ3082.121320344=STDEV.S(D15:D16)
1/1/2022BXYZ100  
1/2/2022BXYZ400212.1320344=STDEV.S(D17:D18)
1/3/2022BXYZ4021.414213562=STDEV.S(D18:D19)
1/4/2022BXYZ4073.535533906=STDEV.S(D19:D20)
1/5/2022AXYZ4112.828427125=STDEV.S(D20:D21)
Don't forget to give thumbs up and accept this as a solution if it helped you!!!
1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Uzi2019 ,

 

Please try:

First create an index column:

vjianbolimsft_0-1668418968759.png

Then apply the measure:

Measure =
VAR _a =
    STDEVX.S (
        FILTER (
            ALL ( 'Table' ),
            [Index] <= MAX ( 'Table'[Index] )
                && [Index]
                    >= MAX ( 'Table'[Index] ) - 1
        ),
        [revenue]
    )
VAR _b =
    MINX ( ALLEXCEPT ( 'Table', 'Table'[channel] ), [date] )
RETURN
    IF ( MAX ( 'Table'[date] ) = _b, BLANK (), _a )

Then show items with no data:

vjianbolimsft_1-1668474762717.png

 

Final output:

vjianbolimsft_0-1668474734659.png

Best Regards,

Jianbo 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

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @Uzi2019 ,

 

Please try:

First create an index column:

vjianbolimsft_0-1668418968759.png

Then apply the measure:

Measure =
VAR _a =
    STDEVX.S (
        FILTER (
            ALL ( 'Table' ),
            [Index] <= MAX ( 'Table'[Index] )
                && [Index]
                    >= MAX ( 'Table'[Index] ) - 1
        ),
        [revenue]
    )
VAR _b =
    MINX ( ALLEXCEPT ( 'Table', 'Table'[channel] ), [date] )
RETURN
    IF ( MAX ( 'Table'[date] ) = _b, BLANK (), _a )

Then show items with no data:

vjianbolimsft_1-1668474762717.png

 

Final output:

vjianbolimsft_0-1668474734659.png

Best Regards,

Jianbo Li

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

Thanks alot. It worked for me.

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Greg_Deckler
Community Champion
Community Champion

@Uzi2019 Try something like this:

 

Measure = 
  VAR __Date = MAX('Table'[Date])
  VAR __NextDate = MINX(FILTER(ALL('Table),[Date] > __Date),[Date])
  VAR __CurrentValue = MAX('Table'[revenue])
  VAR __NextValue = MAXX(FILTER(ALL('Table'),[Date] = __NextDate),[revenue])
  VAR __Result = STDDEVX.S( { __CurrentValue, __NextValue }, [Value])
RETURN
  __Result

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thanks for your reply. I tried your solution but not getting expected output like I mentioned in my first post. 

Capture.JPG

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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