Skip to main content
Announcements
Get Ready. A New Qlik Learning Experience is Coming February 17! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare current month with previous month

Hi Community,

I would like to load several files in one chart to compare the sum of [Wert frei verwend.] with each month.

(not the total sum but the sum of month's end)

I already tried

- vCurrentMonth =Month(Today())  

  sum({<month={'$(vCurrentMonth)'}>}[Wert frei verwend.])

- vPreviousMonth =Month(Today()-31)

  sum({<month={'$(vPreviousMonth)'}>}[Wert frei verwend.])

but it doesn’t work.

LOAD Material,
    
Materialkurztext,
    
Werk,
    
LOrt,
    
BME,
    
[Frei verwendbar],
    
[In QualPrüfung],
    
Gesperrt,
    
Retouren,
    
[Wert frei verwend.],
    
Transitbestand,
    
[Wert in QualPrüfng],
    
[Wert Sperrbestand],
    
date(Date#(Left(FileBaseName(), 10), 'YYYY-MM-DD')) As FileDate

FROM [……2013-**-**.csv]

I appreciate your time and help!

1 Solution

Accepted Solutions
MayilVahanan

HI

Edit:

For today or max date

= sum({<FileDate = {"$(=Today())"}>}[Wert frei verwend.])


or

= sum({<FileDate = {"$(=max(FileDate))"}>}[Wert frei verwend.])


Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

10 Replies
MayilVahanan

HI

Try like this

For this month

= sum({<FileDate = {">=$(=MonthStart(Today()))<= $(=MonthEnd(Today()))"}>}>}[Wert frei verwend.])

For previous month

= sum({<FileDate = {">=$(=MonthStart(AddMonths(Today(),-1)))<= $(=MonthEnd(AddMonths(Today(),-1)))"}>}>}[Wert frei verwend.])


Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thank you for your help but it doesn't work. My chart showes nothing.

Is it possible that there is a mistake in the skript?

MayilVahanan

HI

Its my default, try like this

For this month

= sum({<FileDate = {">=$(=MonthStart(Today()))<= $(=MonthEnd(Today()))"}>}[Wert frei verwend.])

For previous month

= sum({<FileDate = {">=$(=MonthStart(AddMonths(Today(),-1)))<= $(=MonthEnd(AddMonths(Today(),-1)))"}>}[Wert frei verwend.])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

It works!

Now it showes the sum of the whole month (01.08.-31.08.) but I need the sum of the last existing file of the month(31.08)

Is it possible?

MayilVahanan

Hi

Are you need the last date of the month? if so, try like this

= sum({<FileDate = {"$(=MonthEnd(Today()))"}>}[Wert frei verwend.])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Okay thank you:)

is it also possible to load the latest file?

For example 29.8 (current day) and not the 31.08?

MayilVahanan

HI

Edit:

For today or max date

= sum({<FileDate = {"$(=Today())"}>}[Wert frei verwend.])


or

= sum({<FileDate = {"$(=max(FileDate))"}>}[Wert frei verwend.])


Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks a lot! 

MayilVahanan

Hi

Please close this post, its helps other

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.