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
asdf1608
Helper V
Helper V

Window_stdev table(across) along with date in power BI

I am trying to convert tableau dashboard to poewr BI. I am facing an isssue in converting a calculated column called window_stdev.

The formula in tableau is : 

WINDOW_STDEV(SUM([Quantity 2])).

asdf1608_0-1700743801594.png

It seems to be calculating table across specific dimension by date

asdf1608_1-1700743931955.png

The result from tableau is

asdf1608_2-1700744026876.png

The formula I used in power BI  : 

Rolling Stdev =
VAR CurrentRowDate = aa[Date]
VAR RowsToInclude =
    FILTER(
        ALL(aa),
        aa[Date] >= (CurrentRowDate - 2) && aa[Date] <= CurrentRowDate
    )
RETURN
IF(
    COUNTROWS(RowsToInclude) > 1,
    STDEVX.P(RowsToInclude, aa[Quantity2]),
    BLANK()
) // this is not giving me correct answer.
 
The above formula is not giving me the answer same as tableau
The result from power BI is
asdf1608_3-1700744135076.png

I am attaching the excel file and poewr BI file

sample.XLSX

Sample.pbix

 

Help in this is really needed.

 

Thanks in advance

7 REPLIES 7
lbendlin
Super User
Super User

Your sample table "aa"  has 213K rows, but only 18K distinct rows.  What are all these duplicates?

 

Are you sure you want to calculate the standard deviation across three values only?  That will be statistically useless.

@lbendlin 

certain id may repeat. I need the standard deviations for the window across date.

normal standard deviation is coming in power BI. But for the windows it is giving me an wrong answer

Where is this filter 

 FILTER(
        ALL(aa),
        aa[Date] >= (CurrentRowDate - 2) && aa[Date] <= CurrentRowDate
    )
in Tableau?  From your example WINDOW_STDEV calculates across all dates for each ID.

@lbendlin There are no filters. As you said WINDOW_STDEV calculates across all dates for each ID.

I just used the above DAX. It might be wrong.

That's why I raised this. 
I am not sure why to create DAx so that the values matches with Tableau

How do you know the Tableau values are correct?

@lbendlin 

I am not sure if the tableau result is correct. All I want is the formula conversion.

Window_stdev to be calculated across the specified dimension

WINDOW_STDEV(SUM([Quantity 2])).

asdf1608_0-1702461933307.png

 

It seems to be calculating table across specific dimension by date

asdf1608_1-1702461933656.png

 

Please help me in this

 

Thanks in advance

@lbendlin 

I am not sure if the tableau result is correct. All I want is the formula conversion.

Window_stdev to be calculated across the specified dimension

WINDOW_STDEV(SUM([Quantity 2])).

asdf1608_0-1702461933307.png

 

It seems to be calculating table across specific dimension by date

asdf1608_1-1702461933656.png

 

Please help me in this

 

Thanks in advance

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.