9 Replies Latest reply: May 3, 2016 5:29 AM by Sowmya M RSS

    Creating a variable/Column(Using SQL) in Qlik sense data load editor

    Sowmya M

      Hi,

       

      I am new to qlik and am not yet completely familiar with the basics of scripting language in Qlik.

       

      I am trying to achieve a simple indicator which tells me if a account is new or not.

      below is a sample of how the data is structured(I have not shown the other variables)

      acct.PNG

      In the above scenario 2 and 4 are new accts as they opened in 2015.

      I am thinking of simply using min(date) at a account level = '01/01/2015' to create a column that flags a acct as new/old.

      (Data is loaded from excel for now but might be loaded from a SQL ODBC connector in the future)

       

      I used the below code in the MAIN section just to check what happens. It threw a error as expected.

       

      SQL :

      select [ACCT],MIN( CASE when [Snapshot Date]='01/01/2015' THEN 1 else 0 end as [INDICATOR])

      from [Sheet 1]

      GROUP BY [ACCT];

       

      How/where should I place this SQL query? Is it right at all in the first place.

      Is there a way to achieve this simply in the App itself?

       

      Is someone can provide a detailed syntax that will be great as I am starting completely fresh on this tool.

       

      Thanks in advance!