cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Calculating the total number of sales for that number week.

Hi.  

 

I am trying to calcuate from my daily sales total a weekly sales total correlating to the week number.

 

Example would be adding together all 7 entries 0-6 to provide the total for week 13 say in all week 13 entries for that year  I have attched a screen shot,  I am eventally going to use this data to compare WoW MoM YoY sales.   The data runs from 2017 and the formula shown doesnt work for what i require.  The week number is repetative so at the turn of teh year starts from 1 again.

 

Thanks in advance 

 

Screenshot 2019-12-10 at 10.16.25.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Calculating the total number of sales for that number week.

Hi @Anonymous ,

In my opinion, I'd like to suggest you use year and weeknum and conditions to manually filter calculate record.

 

Weekly to date total =
CALCULATE (
    SUM ( TotalSales[Total] ),
    FILTER (
        ALL ( TotalSales ),
        YEAR ( [Date] ) = EARLIER ( TotalSales[Date] )
            && WEEKNUM ( [Date], 2 ) = WEEKNUM ( EARLIER ( TotalSales[Date] ), 2 )
            && [Date] <= EARLIER ( TotalSales[Date] )
    )
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Super User I
Super User I

Re: Calculating the total number of sales for that number week.

Typically, these kind of calculations are done in a measure, but you are trying to do it in a calculated column. That is not a problem per se, it is just worth noting. What is weird though is that you are trying to add this to a calendar table. That just seems odd, unless there is a specific reason for doing so? Could you share a pbix file with you total data structure, (you can make it with dummy data if that helps)? 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Community Support
Community Support

Re: Calculating the total number of sales for that number week.

Hi @Anonymous ,

In my opinion, I'd like to suggest you use year and weeknum and conditions to manually filter calculate record.

 

Weekly to date total =
CALCULATE (
    SUM ( TotalSales[Total] ),
    FILTER (
        ALL ( TotalSales ),
        YEAR ( [Date] ) = EARLIER ( TotalSales[Date] )
            && WEEKNUM ( [Date], 2 ) = WEEKNUM ( EARLIER ( TotalSales[Date] ), 2 )
            && [Date] <= EARLIER ( TotalSales[Date] )
    )
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

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