3 Replies Latest reply: Sep 22, 2017 11:10 PM by Shraddha Gajare RSS

    Avg Days to Pay

    Steven Caruthers

      I am trying to find syntax to write a few statements.



      Avg Days to Bill: The syntax in SQL is DATEDIFF(dd,dc.service_date,dc.bill_date).  I have seen a FLOOR(column-column) but i'm not sure that is the correct way when converting syntax.



      IF Condition: The syntax in SQL is  CASE WHEN "status" = 'Cancelled', THEN  ""status"" ELSE 0 END AS "Cancelled Cases"



      Is there something in Qlik Sense that can replace these?



        • Re: Avg Days to Pay
          Isaac Lin

          For if condition, try

          IF("status" = 'Cancelled', 'status','0') as Cancelled_Cases


          I don't really understand your first question, could you specify it again?

          • Re: Avg Days to Pay
            Steven Caruthers

            Thanks for the reply. I'll try that IF on Monday when I get back to the office and comment back then.


            THe the first question  basically I'm looking for the Qlik syntax for a datediff calculation. service date minus billed date would give me the number of days it took for a bill to go our the door.  I am currently using the floor function ( FLOOR(service_date,billed_date) ). I am just not positive that it's the appropriate way to get a date difference between the two fields.