Forum Discussion

felipeBI's avatar
felipeBI
Regular Visitor
4 years ago

Problem with standar devuation DAX

Good Morning! I have a problem with the fuction STDEV.S (standar devuation)
Data
|2|

|3|

|2|

|9|

|4|

|2|

|5|


In Excel I use the next formula =DESVEST.M(A1:A7), Result: 2.54483604.

In Power BI I have the next table affected with filters with the next formula DESVIACIÓN = CALCULATE(STDEV.S(FactVentas[CANTIDAD]),ALLSELECTED())


Result: 1.07 

 

What is the error?

Thank you so much



3 Replies

  • Hi felipeBI ,

     

    You issue is related with the context of the ALLSELECTED (check documentation) in this case when you do the all selected you are adding not only the ones that have values but also the ones that have 0, and other values that you are not seeing in filter context.

     

    Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

    If the information is sensitive please share it trough private message.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi felipeBI 

    I think your problem lies in ALLSELECTED() .

    ALLSELECTED() : Removes context filters from columns and rows in the current query, while retaining all other context filters or explicit filters. It keeps explicit filters and contexts other than row and column filters. 

    So you will include explicit filters and context in your calculations and the result is different from the result that from excel .

    I created a sample without any filters and the result is same with the result that from excel .

    Column = STDEV.S('Table'[value])

    I have attached my pbix file ,you can refer to it .

     

    Best Regards

    Community Support Team _ Ailsa Tao

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi felipeBI 

    Has your problem been solved ? If it has been solved, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards

    Community Support Team _ Ailsa Tao

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