March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
Please can you tell me how to calculate the standard deviation of a calculated measure? I can only find examples that use calculated columns, not calculated measures. Is it even possible?
I need to find the standard deviation in transaction values ($). I have a calculated measure called "TotalRevenue" and a table field called "TransactionID". There are several table rows per TransactionID so I think I need to group by TransactionID when doing the standard deviation calculation (I need to find the standard deviation between TransactionID's not between table rows)
Thank you for any pointers you can give,
CM
Hi @CloudMonkey,
You can use STDEVX.P() function which supports to calculate based on measure.
Regards,
Yuliana Gu
Use a VAR statement to create a temporary table using something like SUMMARIZE, etc. Include your measure in the table initially or use an ADDCOLUMNS statement to add your measure. Then you can use that temporary table to calculate your standard deviation.
I actually use this technique in my MC Aggregations Quick Measure:
Hi Greg,
Thanks again for trying but I'm afraid this is also too complicated. I'll pull the data into excel and do the calculations there.
Thanks,
CM
If you could supply sample data I bet I could knock this out in like 5 minutes. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Hi Greg, thanks but it's needs to be understandable to analysts without advanced power bi coding otherwise it won't be stable in our company.
Hopefully 2 lines of code is understandable.
Measure StdDev = VAR __table = SUMMARIZE(Table1,[Column1],"__Measure",[Measure]) RETURN STDEVX.P(__table,[__Measure])
Attached sample PBIX as well.
Thank you for your solution AND your sample PBIX. Great answer and not too complicated (once I figured out the DAX syntax LOL)!
Hey Greg,
Our system has a rule ID and a Firing ID. The rule ID stays the same, but with each "firing" there is a new firing ID. I would like to see if there are any rapid increases or decreases in the count of rule IDs per month. I will be looking at 2 years of data and I was thinking about doing a formula that compares the count to see if it is 2 standard deviations away from the average. Is this the best method to find obscurities? Does this make sense? Do you have any suggestions?
Thank you,
Seth
Were you able to do as you described?
What if the measure is a result of info from 2 tables?
How would the code look then?
Love it!!!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
93 | |
91 | |
90 | |
80 | |
49 |
User | Count |
---|---|
160 | |
145 | |
103 | |
72 | |
55 |