Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

how to write a script for last 30 days value(variable)

Hi guys,

I have created a variable. wanted to use it with the belwo last 30 days expression. i coudlnt get any value, iwhat is wrong with the expression??

=Sum( If( AddMonths(Today(),-1) ,$(vAmount1)))

Rgds

Jim

6 Replies
sunny_talwar

Can you show how you define vAmount1 variable?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Jim,

So you mean you want them amount from last 30 days.

Then you should use.

Sum({<Date = {">=$(=Addmonths(Max(Date),-1))"}>}Amount)

If not then please give some example to understand your issue.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
jim_chan
Specialist
Specialist
Author

is very long expression in it.

Sum (If (A_Funds = 'FUNDS_IN', local_amt))

+ Sum(If (B_Funds = 'FUNDS_IN', cust_local_amt))

+ Sum(If (C_funds = 'FUNDS_IN', payout))

-

(Sum (If (A_Funds = 'FUNDS_OUT', local_amt))

+ Sum (If (B_funds = 'FUNDS_OUT', ttl_payout))

+ Sum (If (C = 'FUNDS_OUT'  and claim_com_code <> 'CHY', claim_local_amt)))

- sum(session_actual_winner)

sunny_talwar

So I guess you are trying to do aggregation within aggregation which would require you to use Aggr() function.

jim_chan
Specialist
Specialist
Author

is too long to add in that expression into this:

Sum({<Date = {">=$(=Addmonths(Max(Date),-1))"}>}Amount)

sunny_talwar

Would you be able to share a sample?