Calculating Sales By Period to Date in Power BI

Larotta

New Member
Joined
Jan 9, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

Could you help?

I'm trying to create a sales report which summarises the sales by Week, Period to date & YTD. I've managed to calculate the YTD it's the Period to date I'm having the issues with.

Calendar Example.png


In the calendar table above, I've selected Week 6 (Let's say we have sold 10 units every week to make it easier to understand) So week 6 would 10 units. Period to date would be 20 Units & YTD would be 60 Units.

Below is my measure I used to calculate the YTD units, which works.

For this, I created a couple of other measures, the first measure [WeekMin] takes the minimum week number, the second measure [SelectedWeek] does what it says, uses the selected week from the slicer. The sums all the weeks from week 1 to the week selected:

Sales YTD =
CALCULATE (
[Weekly Sales],
FILTER (
'Sales Table',
'Sales Table'[Time.Week of Year] >= [WeekMin]
&& 'Sales Table'[Time.Week of Year] <= [WeekSelected]
)
)

So basically I would like to calculate the Period to date based on the currently selected week. A few examples:

If I selected week 4 the Period to date units would be 40.
If I selected week 7 the Period to date units would be 30.

Just to note not all periods are 4 weeks, some are 5 weeks.

Many thanks for you help!

L
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top