DateAdd Function

m_aatif

Board Regular
Joined
Apr 18, 2013
Messages
56
While using below mentioned measure, Selecting one year in Pivot table shows values, But if I select all years in column label it ends with an Error.

My Question is can we see all years in Pivot with this function?

DateAdd 1 YrBack:=CALCULATE([TotalSales],DATEADD(Calendar[Date],-1,Year))
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Yes, that is working as designed. It is like saying "when I select 1 gear in my car it works fine, but when I select 2 gears at once there is a loud crunching sound". The measure you refer to is designed to only work with a single year. You can prevent the "gear crunch" by rewriting the measure as follows.

=if(hasonevalue(calendar[year],CALCULATE([TotalSales],DATEADD(Calendar[Date],-1,Year)))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,154
Messages
6,176,731
Members
452,740
Latest member
MrCY

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