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

if date not selected add todays date

Hi,

I cant seem to find the syntax error in the formula below but i would also like to add "If this is not populated I want the date to chose the current date".

how can I add this to the following syntax please.

So if the 'AsAtDate' is populated the date is taken from this but if left empty the data is taken from today.

SUM( {$<%Date<={AsAtDate}, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions ) 

1 Solution

Accepted Solutions
sasiparupudi1
Master III
Master III

=SUM( {$<%Date ={'<=$(=if(len(AsAtDate)=0,Date(Today()),AsAtDate))'}, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions )

View solution in original post

11 Replies
its_anandrjs

Try this

SUM( {$<%Date<={ =Today() }, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions ) 

Regards

Anand

Anonymous
Not applicable
Author

i would like to say "if there is no AsAtDate selected ,  then take today

adamdavi3s
Master
Master

The lazy way (outside set analysis) is:

if (getselectedcount(AsAtDate) =0,

SUM( {$<%Date<={=today()}, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions ) ,

SUM( {$<%Date<={AsAtDate}, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions )

)

Anil_Babu_Samineni

You want to populate only Today date if you are not selecting anything??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Even before you think about adding the if statement, the current expression doesn't seem to look right. Is this working?

Sum({$<%Date<={AsAtDate}, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions)

Are you not getting a error above??

sasiparupudi1
Master III
Master III

=SUM( {$<%Date ={'<=$(=if(len(AsAtDate)=0,Date(Today()),AsAtDate))'}, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions )

ogster1974
Partner - Master II
Partner - Master II

Would you not insert the default date today() value during the load of your data so you avoid the cost of handling this during the dashboards use?

vcanale
Partner - Creator II
Partner - Creator II

or..

if (IsNull(AsAtDate),

SUM( {$<%Date<={=today()}, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions ) ,

SUM( {$<%Date<={AsAtDate}, RecordType= {'WebTraffic'}, Area= {'SR'} >} Sessions )

)

Anonymous
Not applicable
Author

congratulations Sunny