Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

STDEV.S function in DAX to target specific cell range

Hi Everyone,

 

I badly need help to this, I've been searching for a solution in this community for days but still not successful.

 

I have a table in excel that I wanted to create as a calculated table using dax. I've already completed creating the date table, and other columns but I am having challenges to to use STDEV.S function to target on a specific cell range in my data table.

 

See the excel table and formula used in excel in the screenshot below.

 

Thanks in advance

 

Month YearColumn 1Column 2Std DevTotal
Jul-160000
Aug-160000
Sep-160000
Oct-160000
Nov-160000
Dec-160000
Jan-17311.5118578924
Feb-17422.3754698786
Mar-17533.162277668
Apr-17643.9101008810
May-17754.63190516512
Jun-17865.33428021914
Jul-17976.02132960916
Aug-171086.7101148318
Sep-171197.2959419720

 

Std DevTotal
0=C2+D2
=STDEV.S(F2:F3)=C3+D3
=STDEV.S(F2:F4)=C4+D4
=STDEV.S(F2:F5)=C5+D5
=STDEV.S(F2:F6)=C6+D6
=STDEV.S(F2:F7)=C7+D7
=STDEV.S(F2:F8)=C8+D8
=STDEV.S(F2:F9)=C9+D9
=STDEV.S(F2:F10)=C10+D10
=STDEV.S(F2:F11)=C11+D11
=STDEV.S(F2:F12)=C12+D12
=STDEV.S(F2:F13)=C13+D13
=STDEV.S(F2:F14)=C14+D14
=STDEV.S(F3:F15)=C15+D15
=STDEV.S(F4:F16)=C16+D16
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Anonymous ,

    Please try to use below calculated column formulas if they suitable for your requirement:

    Total = [Column 1]+[Column 2]
    
    STDEV.S =
    VAR curr = [Month Year]
    RETURN
        STDEVX.S (
            FILTER (
                ALL ( T5 ),
                [Month Year]
                    >= DATE ( YEAR ( curr ) - 1, MONTH ( curr ), DAY ( curr ) )
                    && [Month Year] <= curr
            ),
            [Total]
        )
    

    Regards,

    Xiaoxin Sheng

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    AFAIK, power bi data model not contains row index and column index.
    I'd like to suggest you add a index column on query editor side, then you can write complex conditions to return correspond calculation formula based on current row index.

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the info Anonymous .

      Already created an index using the formula below as my table is created using dax:

      Index = CALCULATE(COUNTROWS('CR Trend'), FILTER(ALL('CR Trend'), 'CR Trend'[Year-MonthName].[Date]<= EARLIER('CR Trend'[Year-MonthName].[Date])))

      However tried creating some conditions but it's not working. I don't know what functions to be use etc as I am new to DAX functions.

       

      Any suggestion how to build that condition is very much appreaciated.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    I badly needed help in this one as I haven't found any solution yet.

     

    I have a calculated column and wanted to create a STDEV.S column using dax to calculate the first 13 cell then calculate 1 cell down (next 13) and so on.

     

    If you'll look in an excel table, it is similar to below.

    Index
    Month YearColumn 1Column 2Std DevTotal
    1Jul-160000
    2Aug-160000
    3Sep-160000
    4Oct-160000
    5Nov-160000
    6Dec-160000
    7Jan-17311.5118578924
    8Feb-17422.3754698786
    9Mar-17533.162277668
    10Apr-17643.9101008810
    11May-17754.63190516512
    12Jun-17865.33428021914
    13Jul-17976.02132960916
    14Aug-171086.7101148318
    15Sep-171197.2959419720

     

    DevTotal
    0=C2+D2
    =STDEV.S(F2:F3)=C3+D3
    =STDEV.S(F2:F4)=C4+D4
    =STDEV.S(F2:F5)=C5+D5
    =STDEV.S(F2:F6)=C6+D6
    =STDEV.S(F2:F7)=C7+D7
    =STDEV.S(F2:F8)=C8+D8
    =STDEV.S(F2:F9)=C9+D9
    =STDEV.S(F2:F10)=C10+D10
    =STDEV.S(F2:F11)=C11+D11
    =STDEV.S(F2:F12)=C12+D12
    =STDEV.S(F2:F13)=C13+D13
    =STDEV.S(F2:F14)=C14+D14
    =STDEV.S(F3:F15)=C15+D15
    =STDEV.S(F4:F16)=C16+D16
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous ,

      Please try to use below calculated column formulas if they suitable for your requirement:

      Total = [Column 1]+[Column 2]
      
      STDEV.S =
      VAR curr = [Month Year]
      RETURN
          STDEVX.S (
              FILTER (
                  ALL ( T5 ),
                  [Month Year]
                      >= DATE ( YEAR ( curr ) - 1, MONTH ( curr ), DAY ( curr ) )
                      && [Month Year] <= curr
              ),
              [Total]
          )
      

      Regards,

      Xiaoxin Sheng

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

         

        I was able to replicate the formula you've provided and make it works. This is what I am looking for.

         

        Thanks you very much for your help on this.