Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Expression help

Hi All,

i want to add some bucketing in my expression ..

This is my expression

SUM({$<FinancialYear=,Quarter=,MonthName=,[Date] ={"<=$(=MonthEnd(Max([Date])))"}>}[Sale])

And I want to add below condition in above expression

=if((num((num(vDateForAgeing)-[Post Date ]),'#######0') )<=180 ,'Below Six Month',

if(num((num(vDateForAgeing)-[Post Date ]),'#######0')>=180.1,'Above 181',

0))

Thanks

12 Replies
senpradip007
Specialist III
Specialist III

Could you explain vDateForAgeing ?

Anonymous
Not applicable
Author

vDateForAgeing

=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MonthEnd(MAX(Date))),DATE(Today()))

Anonymous
Not applicable
Author

What exactly you want to achieve by adding this condition in your expression?

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=if((num((num(vDateForAgeing)-[Post Date ]),'#######0') )<=180  AND num((num(vDateForAgeing)-[Post Date ]),'#######0')>=180.1,

SUM({$<FinancialYear=,Quarter=,MonthName=,[Date] ={"<=$(=MonthEnd(Max([Date])))"}>}[Sale]))

Regards,

Jagan.

jonathandienst
Partner - Champion III
Partner - Champion III

If vDateForAgeing and Post Date are numeric QV date values, then this is enough:

...

If(vDateForAgeing - [Post Date ] <= 180, 'Below Six Month',

  If(vDateForAgeing - [Post Date ] >=180.1, 'Above 181', 0)) As Buckets,

...

If there are more buckets, you might want to consider interval matching rather than a nested if. Does [Post Date ] really have a trailing space in the field name?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Hi Jagan,

I need to create two separate column for this .

Thanks

Anil_Babu_Samineni

Perhaps This

=if(num(num(vDateForAgeing)-[Post Date]),'#######0') <= Num(180),'Below Six Month', num((num(vDateForAgeing)-[Post Date ]),'#######0')>=180.1,'Above 180.1', SUM({$<FinancialYear=,Quarter=,MonthName=,[Date] ={"<=$(=MonthEnd(Max([Date])))"}>}[Sale]))

If you use this, What you are getting in your application, Would you provide sample application which demonstrates the o/p. If this gives number let me know. Better approach is want to see.

LET vDateForAgeing = IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MonthEnd(MAX(Date))),DATE(Today()))

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
miskin_m
Partner - Creator
Partner - Creator

Hi Vijay,

You need to add your aging expression as a calculated dimension to create two columns under dimension tab.

Hope this is what you want.

Anonymous
Not applicable
Author

Hi Vijay,

In your expression, have you tried to floor the expression. Something like:

=if((num((num(floor(vDateForAgeing))-[Post Date ]),'#######0') )<=180 ,'Below Six Month',

if(num((num(floor(vDateForAgeing)-[Post Date ])),'#######0')>=180.1,'Above 181',

0))