Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
lauracastagna
Creator II
Creator II

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

lauracastagna
Creator II
Creator II
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??

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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
Master II
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 )

)

lauracastagna
Creator II
Creator II
Author

congratulations Sunny