Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
luiz_damascena
Contributor III
Contributor III

Subtracting dates with aggr function

I have a chart (PivotTable). In it, as dimensions, I display the fake columns "Days1_" - = (Interval (Today () - date_task, 'd')) - and "Media_" - =(Round (aggr (avg (interval (today () (data (today ())) d ')), city_task, burgh_task, phase_task, my_task))).

The values are properly displayed.

But when I create a fake column "Dif_" -

=
(Interval (Today () - date_task, 'd'))
-
(Round (aggr (avg (interval (today () - data_task, 'd'))), city_task, burgh_task, phase_task, my_task))

The result is null. Why?

My ultimate goal is to set background colors (if days1_> media_1, red; if days1_ <media_, green; if days1_ = media_, yellow), but with result null, the test for setting colors doesn't work ...

Thanks in advance for any help.

8 Replies
Anil_Babu_Samineni

Is that syntax issue? Or can you share what you are getting using 2 different expressions

=(Interval (Today () - date_task, 'd'))-(Round (aggr (avg (interval (today () - data_task, 'd'))), city_task, burgh_task, phase_task, my_task)))

Please remove red parenthesis and add it in the blue color

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
luiz_damascena
Contributor III
Contributor III
Author

I wrote wrong - the definition of "Media_" is

(Round (aggr (avg (interval (today () - data_task, 'd'))), city_task, burgh_task, phase_task, my_task))

 

luiz_damascena
Contributor III
Contributor III
Author

Thanks, but I believe that I wrote wrong, in the post... in my qvw, the definition is like you wrote, with the parenthesis in the correct position.

Anil_Babu_Samineni

What is the out put you've got using both expressions?

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
luiz_damascena
Contributor III
Contributor III
Author

The output is "-", that is the defined as the Null Symbol in Presentation Tab.

Anil_Babu_Samineni

Can we have sample application to test ?

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
luiz_damascena
Contributor III
Contributor III
Author

Thanks again, but in this case, I don't know how to do that... it´s a big qvw, with a lot of code on script... I don't know how to generate data to mount the test, to send... I'm sorry, and thanks again.

 

Why can I see the colums but I can't do a math operation using them? Mind blowing!

 

Brett_Bleess
Former Employee
Former Employee

Luiz, you can use the File\Reduce Data\Keep Possible in the Desktop client, but be sure you make some selections first to be sure there is some data still left in the data model.  If there are any confidential fields as well, use the Settings\Document Properties\Scrambling tab to scramble those...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.