cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Aggregating daily data.

I am trying to aggregate my daily frequency data into weeks and then calculate an average of weekly sales.

 

So the average-average for the following data would be

 

Week

Sales

1

50

1

65

2

52

2

63

3

12

3

16

 

Week 1: 50+65 = 115

Week 2: 52 + 63 = 115

Week 3: 12 + 16 = 28

 

Average Sales by week = 86.

 

It's important that I calculate it this way as I'd like to use the VAR.S command to calculate the variance of Weekly Sales.

 

Thanks for any assistance,

 

Regards,

 

Gareth.

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Aggregating daily data.

Hi @jazking123

 

HEre is one way (of a few) that you can do it

 

 

 

Sales2 = IF(
				ISFILTERED('Table1'[Week]), 
				CALCULATE(SUM('Table1'[Sales])),
				DIVIDE
					(
						SUM(Table1[Sales]),
						DISTINCTCOUNT('Table1'[Week]))
					)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Aggregating daily data.

Hi @jazking123

 

HEre is one way (of a few) that you can do it

 

 

 

Sales2 = IF(
				ISFILTERED('Table1'[Week]), 
				CALCULATE(SUM('Table1'[Sales])),
				DIVIDE
					(
						SUM(Table1[Sales]),
						DISTINCTCOUNT('Table1'[Week]))
					)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Highlighted
Frequent Visitor

Re: Aggregating daily data.

That's perfect.

 

Thank you sir.

 

*Update*

 

Sadly I think i was mistaken, the reply posted seems to calculate the average value. I need the process to occur in two stages. I'm hoping that the first aggregates by week and the second takes the average of the weeks. I need it to do this so I can calculate the variation between weeks.

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors