Week and Previous Week

cmcreynolds

Active Member
Joined
May 21, 2015
Messages
295
Okay, I am fighting fatigue and possibly the flu this morning and I have been stuck on this logic:

In a Power Pivot Data Model, I have a date field in my main table [AppDate]. I also have a calendar table with week number and a look up for that week number in my main table.

What I want is a pivot table that has one column for a week's total (count of the date or a dummy code?) and another column counting the previous week's total. I can't figure out whether to use a calculated column or a calculated field.

I know this is simple, but I just can't wrap my head around it today.

Please and thank you.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi Chris,
heads up - long weekend ahead!

You need to shift your dates 7 days back, as there is no WEEK-function in DAX. So if you take the week column into the row section of your pivot, there's no need for a special aggregation for the current week. Just take a simple SUM-measure.
For the previous week it will be:

PreviousWeek:=CALCULATE([SumMeasure]; DATEADD(DimDate[Date],-7,DAY))
 
Upvote 0

Forum statistics

Threads
1,224,157
Messages
6,176,744
Members
452,741
Latest member
Muhammad Nasir Mahmood

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