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: 
pgalvezt
Specialist
Specialist

Dimmension like as into the script

hello, I have this in my Dimmension Calculated. Works fine, but Consume a lot of memory How can I traslate this into the script and finally left it like "as".?

=

if(aggr(sum(date(vDate)-Field1),Field2)= vDate, Dual('YTD',1),

if(aggr(sum(date(vDate)-Field1),Field2)>=1 And aggr(sum(date(vDate)-Field1),Field2)<=30, Dual('Period1',2),

if(aggr(sum(date(vDate)-Field1),Field2)>=31 And aggr(sum(date(vDate)-Field1),Field2)<=60, Dual('Period2',3))))

Thanks,

1 Solution

Accepted Solutions
Not applicable

6 Replies
Not applicable

In the data model if Field1 and field2 are in same table; add a column in the script with same if conditions and using group by Field1. Use left join to ensure unnecessary results are not included.

Kiran.

pgalvezt
Specialist
Specialist
Author

Thanks for your reply. I Tried to put your information on my qvw but doesn't work I attached an example with my code.

Not applicable

Try this.

Kiran.

pgalvezt
Specialist
Specialist
Author

Thanks. Just last question.

I had a variable Let and I have created a Calendar Object where I choose the last month, so all Fields1 are subtracted on 31/01/2012 for example. So I know you put a variable: Vdate = Today(); How should the variable stay If:

Vdate-Field1 ==> Where Vdate is endMonth.?

Vdate=EndMonth(); ?

Thanks.

Not applicable

Since the periods are defined in script, they cannot be changed in expression level.

To get end of month use MonthEnd(today()).

Kiran.

pgalvezt
Specialist
Specialist
Author

Many Thanks.