Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If Statement using Dates in Chart Caption Expression

Hi,

I am trying to use the expression below to automate the "YTD through" date in a chart caption. I need to test for transaction records that slip in after midnight and before our nightly data refresh completes at like 4am (so MaxShipDate becomes today versus yesterday) and if found, use the "Yesterday" MaxShipDate variable versus the regular MaxShipDate variable. A similar If statement is working correctly in my expressions to pull year over year sales totals. My chart caption reads "Error:Error in expression:"  Any ideas?  Thanks in advance!

='Year over Year Net Shipped Sales through '& (=if(vMaxShipDate = (Today()),DATE(vMaxShipDateYesterday, 'MMM DD, YYYY'),DATE(vMaxShipDate, 'MMM DD, YYYY')))

In case it's helpful, this is the chart in question. The Demand version works because we always have a few Today records and can just use the Yesterday variable. With Shipped, it's a day to day coin toss.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I believe the second equal sign needs to be removed from the expression:

='Year over Year Net Shipped Sales through '& if(vMaxShipDate = (Today()),DATE(vMaxShipDateYesterday, 'MMM DD, YYYY'),DATE(vMaxShipDate, 'MMM DD, YYYY'))

View solution in original post

2 Replies
swuehl
MVP
MVP

I believe the second equal sign needs to be removed from the expression:

='Year over Year Net Shipped Sales through '& if(vMaxShipDate = (Today()),DATE(vMaxShipDateYesterday, 'MMM DD, YYYY'),DATE(vMaxShipDate, 'MMM DD, YYYY'))

Not applicable
Author

I need to do some more extensive testing, but this appears to work exactly as expected. Thanks for your help!