Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi power bi community,
currently I struggle with calculating a measure, based on the filter selection. My data looks like the following:
The complete power bi app can be found here.
I want to calculate the standard deviation of the revenue. In my case I want to know the standard deviation of every single country over all selected months.
Of course, dependend on what the user selects, the standard deviation has to be recalculated. The user might for example select only certain articles.
What I understand is, when using the available function stdev.p, the calculation is done not on the displayed and summed up values, but on every single row in the table which holds the data in the background.
I also tried everything with the stdevx.p function together with the allexcept function. As you can see the standard deviation is not calculated based on the values in the revenue column. The expected result is e.g. for Austria 314,22. As an example I calculated that in excel:
Because of that "limitation" i tryed to calculate the standard deviation on my own with measures step by step. Meanwhile I'am sure, that this is nothing which is good and afterwards also maintainable. So, can please somebody support us in solving that problem? I'am sure there is a much better way or even just a simple solution for that.
Thank you very much in advance for you support.
Best regards,
Tom
Solved! Go to Solution.
Hi @Anonymous ,
>>I mean, it is a general problem for me to calculate something based on what there is shown in the power bi matrix.
In this scenario, we will need to use the measure rather than a calculated column, a calculated column will be calculated on whole data, the filter will not change it.
We can create a measure using the following DAX query:
STDEV1 = CALCULATE(STDEV.P(Tabelle1[Revenue]),FILTER(ALL(Tabelle1),Tabelle1[Country] = MIN(Tabelle1[Country]) && Tabelle1[Distinct Monat] in ALLSELECTED(Tabelle1[Distinct Monat])))
The result will like below:
Best Regards,
Teige
Meanwhile you can try the following formula as "Calculated Column" (Not Measure):
Hi Gopal30,
meanwhile I tryed your proposal. Unfortunately I had no success.
Here is what I did (it is a column - no measure):
Any other suggestion what I can do? I mean, it is a general problem for me to calculate something based on what there is shown in the power bi matrix. Average is another example where I want to calculate column total divided by number of rows within the matrix and show this in every row.
Anyway, thank you very much for your reply.
Best regards,
Tom
Hi @Anonymous ,
>>I mean, it is a general problem for me to calculate something based on what there is shown in the power bi matrix.
In this scenario, we will need to use the measure rather than a calculated column, a calculated column will be calculated on whole data, the filter will not change it.
We can create a measure using the following DAX query:
STDEV1 = CALCULATE(STDEV.P(Tabelle1[Revenue]),FILTER(ALL(Tabelle1),Tabelle1[Country] = MIN(Tabelle1[Country]) && Tabelle1[Distinct Monat] in ALLSELECTED(Tabelle1[Distinct Monat])))
The result will like below:
Best Regards,
Teige
Hi @TeigeGao,
checking this post, I think have similar issue when it comes to add a standard deviation as a measure.
I have a pivot table with data coming from my data model, showing following data:
- Week numbers in columns [weeknum]
- Product ID in rows [Producto]
- Quantity consumed as Σ [Cantidad]
Point is, a lot of products have zero consumption along the year.
Here comes a screenshoot (week numbers reduced for pasting smaller picture):
What I want is to add a measure showing the total standard deviation as a column at the end based on column selection (eventually will be 52 weeks).
Can you advise?
Thanks,
Can you share the pbix file with sample data?
Hi Gopal30,
thank you for your fast response. Please find the file here: https://ufile.io/eojbwrjt
Best regards,
Tom
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
73 | |
58 | |
36 | |
32 |
User | Count |
---|---|
90 | |
62 | |
61 | |
49 | |
45 |