- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

# DAX sum of square of weekly sales

[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-08-2018 03:59 AM - edited 11-08-2018 04:02 AM

Hi.

I have a measure [Sales Quantity2] that is defined as the sum of a column Sales[Quantum].

Now I want to calculate the std.dev and mean of [Sales Quantity2] for a given period. Week by week. The mean is easy, just calculate [Sales Quantity2] divided by number of weeks.

To calculate the std.dev I need to sum up quantum for an entire week, square it, and then sum over weeks. How to do this?

I.e. need to make a measure that can sum up SQ3 in this table

Solved! Go to Solution.

Accepted Solutions

## Re: DAX sum of square of weekly sales

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-08-2018 04:54 AM

can you post sample anonymised data?

in general I'd go with STDEVX.P or STDEVX.S & SUMMARIZE

https://docs.microsoft.com/en-gb/dax/stdevx-s-function-dax

Measure = STDEVX.S ( ADDCOLUMNS ( SUMMARIZE ( Table, Table[Week No] ), "SQ2", [Sales Quantity2] ), [SQ2] )

you would need to adjust blue description and maybe replace STDEVX.S with STDEVX.P

All Replies

## Re: DAX sum of square of weekly sales

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-08-2018 04:54 AM

can you post sample anonymised data?

in general I'd go with STDEVX.P or STDEVX.S & SUMMARIZE

https://docs.microsoft.com/en-gb/dax/stdevx-s-function-dax

Measure = STDEVX.S ( ADDCOLUMNS ( SUMMARIZE ( Table, Table[Week No] ), "SQ2", [Sales Quantity2] ), [SQ2] )

you would need to adjust blue description and maybe replace STDEVX.S with STDEVX.P

## Re: DAX sum of square of weekly sales

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-12-2018 01:32 AM

Worked great. Thanks