Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
joshrussin
Creator III
Creator III

Current month data

Trying to figure out how to calculate current month processes.

expression:

=Sum({$<Status_Dash={'Completed'}, Month={"$(Month(addmonths(today(),-0)))"}>} Processed_Dash)

the return value should be 4342, but it is returning all data from "completed" in the database, including previous months.

current month.PNG

1 Solution

Accepted Solutions
sunny_talwar

You cannot use functions on the right hand side of the set modifier.... you will need to create Month field in the script

Month(Date_Dash) as Month

and then use this field in your set analysis

=Sum({$<Status_Dash={'Completed'}, Month= {"$(=Month(Today()))"}>} Processed_Dash)

View solution in original post

20 Replies
Anil_Babu_Samineni

I am not sure why Month involved here, you could use this to achieve

Sum({<Status_Dash = {'Completed'}>} Processed_Dash)

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
Anil_Babu_Samineni

From your expression, Synthetically this?

=Sum({$<Status_Dash={'Completed'}, Month={"$(=Month(addmonths(today(),-0)))"}>} Processed_Dash)

OR

=Sum({$<Status_Dash={'Completed'}, Month={'$(=Month(today()))'}>} Processed_Dash)

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
joshrussin
Creator III
Creator III
Author

Because this is just a snapshot of this months data. There is previous data in the database as well.

joshrussin
Creator III
Creator III
Author

I've tried both of those and they both return everything 'completed' from the database.

sunny_talwar

How is your Month field created in the script?

Anil_Babu_Samineni

My first expression will return 4342, Only. Aren't you?

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
sunny_talwar

May be this

=Sum({$<Status_Dash={'Completed'}, Month = {"$(=Month(Today()))"}>} Processed_Dash)

Where Month is created in the script like this

Month(Date_Dash) as Month

jcampbell474
Creator III
Creator III

Can you try:

sum({<Status_Dash={'Completed'},Date_Dash={">=Date(MonthStart(Today(1))) <=Date_Dash(MonthEnd(Today(1))"}>}Processed_Dash)

Use this one.  I had an incorrect field in the first one:

sum({<Status_Dash={'Completed'},Date_Dash={">=Date(MonthStart(Today(1))) <=Date(MonthEnd(Today(1))"}>}Processed_Dash)

joshrussin
Creator III
Creator III
Author

Hmmm, I tried this and still returns all of the collected data. Not just this month.