Forum Discussion
Anonymous
3 years agoNot applicable
Average Standard deviation calculated per month
Hi I want to calculate a montly standard deviation
I want to calculate the standard devation in DAX from my fact table but not the SD per row but totalled per month.
My data looks like this
| Customer | date | Sales |
| A | 1-1-2023 | 20 |
| A | 15-1-2023 | 50 |
| A | 5-2-2023 | 10 |
| A | 10-3-2023 | 150 |
| B | 1-1-2023 | 50 |
| B | 5-3-2023 | 1 |
Now I want a DAx formula which first calculates the total sales per month. e.g. for customer A see below and after that calculates the standard deviation per month.
| Customer | Month | Sales |
| A | 1-2023 | 70 |
| A | 2-2023 | 10 |
| A | 3-2023 | 150 |
If i would calculate the st dev using
STDEV.P(Tabel[Sales]) this gives me 57.35 which is correct. How can i build this logic in to a dax formula
hope you can help me
hope you can help me
2 Replies
- some_bih
Community Champion
Hi Anonymous try measure
STDEVX.P(Sheet29,Sheet29[Sales])Sheet29 adjust to your table nameConnect date column with Date table and check results. You provided sample of data so it is hard to check if it is ok. I hope this help - eliasayyy
Memorable Member
if you want the sum of sales for each month alone, try using
SUMX(values([Month-Year]),[sales measure])or
CALCULATE(SUM([Amount]),ALLEXCEPT(Table,[Month-Year],[Category]))
this will give you sum of sales by month - year use the first if you dont have ctageories an dsub categories and use the second if you have categories and sub categories