Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
neapicture
Contributor III
Contributor III

GetFieldSelections-Function - calculate the previous month

Hey Guys,

I have a problem with the GetFieldSelections-Function. I would like the Month before the Selection (previous month)

That is my expression:

=Sum({<Monat={"$(=GetFieldSelections(Monat)-1)"}>}Plan)

The calculation of the currently selected month works

Could you help me?

Thank you very much!

6 Replies
tresesco
MVP
MVP

Are you selecting a single month value? How did you create month field in the script, using month()?

neapicture
Contributor III
Contributor III
Author

Yes, a single month is always chosen.

Only there does the calculation need to work

... and i use Month()

Month(Datumsfeld) AS Monat,

SET MonthNames='Jan;Feb;Mrz;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez';

---

tresesco
MVP
MVP

Try formatting the dual to string for set comparison like:

=Sum({<Monat={"$(=Month(Date#(GetFieldSelections(Monat)-1,'M')))"}>}Plan)

tresesco
MVP
MVP

Try formatting the dual to string for set comparison like:

=Sum({<Monat={"$(=Month(Date#(GetFieldSelections(Monat)-1,'M')))"}>}Plan)

neapicture
Contributor III
Contributor III
Author

...the part of the formula "-1" does not work for me. I think there is the problem. But I have no solution

=Sum({<Monat={"$(=Month(Date#(GetFieldSelections(Monat)-1,'MMM')))"}>}Plan)

tresesco
MVP
MVP

Could you post a sample qvw?