OR Formula in Power Pivot

Deep Dave

Board Regular
Joined
Mar 22, 2013
Messages
77
I am trying to input a Formula in PowerPivot as below -

=IF(OR([Month]=1,[Month]=2,[Month]=3),YEAR([Excise_Invoice_Date]-1),YEAR([Excise_Invoice_Date]))

I However realized OR can handle only 2 Arguments in Power Pivot.

I simply want the Year to be returned as the Actual Year - 1, if the Month serial number is 1,2 or 3.

However, the Formula is returning an Error.

Can anyone help?

Deep
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I assume that you're creating a calculated column, so this should work:
Code:
IF(
    [Month]=1 || [Month]=2 || [Month]=3, 
    YEAR([Excise_Invoice_Date]) - 1, 
    YEAR([Excise_Invoice_Date])
)
 
Upvote 0
Works Perfectly!

Just wanted to understand, what does || denote?

Thank You,

Deep
 
Last edited:
Upvote 0
The "||" means OR; it just doesn't have the two-item limit that the OR() function has. You can also use "&&" for AND. Once you start using || and &&, you'll probably find that you never bother with OR() or AND() in your Power Pivot models because they're just so much more convenient. (At least it's been that way for me!)
 
Upvote 0

Forum statistics

Threads
1,223,990
Messages
6,175,816
Members
452,672
Latest member
missbanana

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