Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Set Analysis

Hi All,

I have one expression written in set analysis i.e.

=SUM({<Period_NR={'>=$(=vCurrYear_SelectedMnth1)'}>}IB_1)

This expression is working fine and i  getting correct result.

I have written one more expression i.e.

=SUM({<Period_NR={'>=$(=vPrevYear_SelectedMnth1)'}>}IB_1)

This value is showing wrong is there anything i have written wrong.

In the variable vCurrYear_SelectedMnth1 i have written getfieldselections(Period_NR)


In the variable vPrevYear_SelectedMnth1 i have written AddMonths(getfieldselections(Period_NR),-12).


Please suggest


Thanks,

Bharat

1 Solution

Accepted Solutions
sunny_talwar

You seem to need a single day, yet you use >=... can you elaborate why? Seems to work without it

=SUM({<Period_NR={'$(=vPrevYear_SelectedMnth1)'}>}IB_1)

View solution in original post

14 Replies
mdmukramali
Specialist III
Specialist III

Hi,

Maybe

=SUM({<Period_NR={'>=$(=vPrevYear_SelectedMnth1)'},Period_NR=>}IB_1)


sunny_talwar

There could be multiple issues

1) Do you select just one Period_NR?

2) Do you make selection in any other date or time field other than Period_NR?

3) What is the format of Period_NR field?

bharatkishore
Creator III
Creator III
Author

Thanks for the quick reply Mukram, but the expression what you have given i m getting wrong..

bharatkishore
Creator III
Creator III
Author

Hi Sunny,

Yes there will always one selected.

I don't make any other selection in any other date or time field.

format is given below image

T.PNG

Please let me know if you require anything more..

sunny_talwar

Try these

=Sum({<Period_NR = {">=$(=Date(AddMonths(Max(Period_NR), -12), 'MM/DD/YYYY'))"}>} IB_1)

bharatkishore
Creator III
Creator III
Author

Hi Sunny ,

I have tried your expression but the value is wrong:

Please see the below images :

When i select the current month i m getting correct value

T1.PNG

The same when i select last year i.e. 07/01/2016 instead of 4392 i m getting 83908

T2.PNG

sunny_talwar

Is it the same text box? If it is then when you selected 07/01/2016, it is showing the value from 07/01/2015

bharatkishore
Creator III
Creator III
Author

Hi Sunny,

Please find the attached app which will be helpful.

Thanks,

Bharat

sunny_talwar

Try this

=Sum({<Period_NR = {"$(=Date(AddMonths(Max(Period_NR), -12), 'MM/DD/YYYY'))"}>} IB_1)