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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
deepakqlikview_123
Specialist
Specialist

Set analysis Syntax not working properly for current year and PY

Hi All,

PFA.

in text boxes I have shown it seems results are not showing properly for current year and Previous year.

We  need to show the results for max year and max year - 1 for max month.

Please suggest.

Thanks

14 Replies
stabben23
Partner - Master
Partner - Master

Why use max(year) if you whant to show current year? Max year will give you max from you dataset, in Your case 2018. Why not build a variable that holds year(today()) and use variable if you what current year.

The if handling in Your Expression is not necessary then.

fashid
Specialist
Specialist

Hi Staffan ,

I Also thought the same but if you look at his expression closely he is trying to check the summation of the Data field , i.e. if the Data feild is = 0 for the max(year) then calculate for the max(Year)-1 else the max year hence he needs the if expression in set analysis .

regards,

nadeem

deepakqlikview_123
Specialist
Specialist
Author

Hi All,

Max year seems ok but if i need YTD june results how shall i go ahead based on month num.

Thanks

stabben23
Partner - Master
Partner - Master

=if((Sum({<Year={'$(=(max(Year)))'},Month_Num={"<=$(=max(Month_Num))"},Flag={'P&L_Actual'},PARTICULARS={'Net Revenue'}>}Data))
=0,
(
Num(Sum({<Year={'$(=(max(Year)-1))'},Month_Num={"<=$(=max(Month_Num))"},Flag={'P&L_Actual'},PARTICULARS={'Net Revenue'}>}Data)*1000,'$ #,##0 K')),
  (
Num(Sum({<Year={'$(=(max(Year)))'},Month_Num={"<=$(=max(Month_Num))"},Flag={'P&L_Actual'},PARTICULARS={'Net Revenue'}>}Data)*1000,'$ #,##0 K')))

add <= before $ as in Expression above

stabben23
Partner - Master
Partner - Master

Yes, But current year is the year we are in now, if he want to handle "selected" year it is an other story. A textbox With current year header is for me a static value that shows current year no matter what selection. Oterwise I should show it in an other Object. Thats why I wondering about the if handeling.