Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

sum up all sales before current month

I have recent 3 years sales data, I'm trying to sum up all sales before August (current month) in these years. My function is:

Sum({<Month={"<(=month(today()))"}>}Sales)

The result is 0, I have no idea what's wrong. Any ideas?

Thanks in advance!!

23 Replies
wanyunyang
Creator III
Creator III
Author

This works good.

andrey_krylov
Specialist
Specialist

Well, then for test try          Sum({$<Month={'$(=Month(AddMonths(Today(), -1)))'}>} Sales)

balabhaskarqlik

If you resolved the issue, please close this thread.

wanyunyang
Creator III
Creator III
Author

No it's not solved. I think William is only trying to test a comparison.

wanyunyang
Creator III
Creator III
Author

Works good as well.

wanyunyang
Creator III
Creator III
Author

stalwar1

Hi Sunny, could you please help on this?

sunny_talwar

May be adding a dollar sign might resolve the issue

Sum({<Month = {"<$(=Month(Today()))"}>}Sales)

wanyunyang
Creator III
Creator III
Author

no, the result is still 0

william_fu
Creator II
Creator II

Maybe make your requirement clearer?

You replied "this works good" on two comments, which leads everyone to interpret them as working solutions. What worked and what didn't?

sunny_talwar

May be create a new field in the script like this

Num(Month(Date)) as NumMonth

and then try this

Sum({<NumMonth = {"<$(=Num(Month(Today())))"}>}Sales)