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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
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!

Labels (1)
6 Replies
tresB
Champion III
Champion III

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';

---

tresB
Champion III
Champion III

Try formatting the dual to string for set comparison like:

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

tresB
Champion III
Champion III

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)

tresB
Champion III
Champion III

Could you post a sample qvw?