-1

I want to found the count of days remaining in the year in SAQL .

q= foreach q generate daysbetween(toDate(date_to_epoch(year_start_day))-now()) as 'daysRemaining'

I want apply formula 365-now() in saql

Please help me !!

0

You could do something like this to calculate each date's distance to the end of the year...

q = foreach q generate 
  daysBetween(
    toDate('DATA-DATE-FIELD', "yyyy-MM-dd"), 
    year_last_day(toDate('DATA-DATE-FIELD', "yyyy-MM-dd"))
  ) as 'EOY Distance';

I just tested it and it seems to work out:

Date       EOY Distance
...
2014-12-30 1
2014-12-31 0
...

https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_saql.meta/bi_dev_guide_saql/bi_saql_functions_lastday.htm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.