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: 
Luisanabria
Creator
Creator

Set Analysis

Hi all,

lm using set analysis in a graph expression:

if(Sum({<Year={$(=Max(Year))}>} Year<>'2023'),'NoData, Sum({<Year={$(=Max(Year))}>} [Sales Budget HQ]))

 

but l dont know what is wrong because in the next comparative, Set Analysis is adding January and February and puts in January . (22.63M)

fernandoflogtz_0-1679419562464.png 

Red is the wrong amount, amount should be 7.59M, maybe lm using an incorrect expression

I want something as next comparative:

fernandoflogtz_1-1679419848027.png

lm using the same Set Analysis in both examples only changing the Year, because variables has the same name but in different App, but in the first is not working ok

 

Thanks in advance

 

 

Labels (4)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

This is correct : Sum({<Year={$(=Max(Year))}>} [Sales Budget HQ])   

This is INCORRECT : Sum({<Year={$(=Max(Year))}>} Year<>'2023' )

 

if you want to compare Jan 2022,Feb 2022  vs Jan 2023 ,Feb 2023 ,  do the below

1) Dimension : Use the Month field ; which has values Jan,Feb,Mar etc  AND NOT Month-Year

2) Add 2 Measures, one for 2023 and another for 2022

Latest Year(2023,Jan to Date)

Sum({<Year={$(=Max(Year))}>} [Sales Budget HQ])   

Full  Year 2022(Jan to dec)

= Sum({<Year={$(=Max(Year)-1)}>} [Sales Budget HQ])   << this will return full year 2022

YTD 2022(2022, Jan to date)

= Sum({<Datefield={">=$(=YearStart(Max(Datefield),-1))<=$(=AddYears(Max(Datefield),-1))"}>} [Sales Budget HQ])

replace Datefield  with your actual date field name

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

3 Replies
vinieme12
Champion III
Champion III

This is correct : Sum({<Year={$(=Max(Year))}>} [Sales Budget HQ])   

This is INCORRECT : Sum({<Year={$(=Max(Year))}>} Year<>'2023' )

 

if you want to compare Jan 2022,Feb 2022  vs Jan 2023 ,Feb 2023 ,  do the below

1) Dimension : Use the Month field ; which has values Jan,Feb,Mar etc  AND NOT Month-Year

2) Add 2 Measures, one for 2023 and another for 2022

Latest Year(2023,Jan to Date)

Sum({<Year={$(=Max(Year))}>} [Sales Budget HQ])   

Full  Year 2022(Jan to dec)

= Sum({<Year={$(=Max(Year)-1)}>} [Sales Budget HQ])   << this will return full year 2022

YTD 2022(2022, Jan to date)

= Sum({<Datefield={">=$(=YearStart(Max(Datefield),-1))<=$(=AddYears(Max(Datefield),-1))"}>} [Sales Budget HQ])

replace Datefield  with your actual date field name

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
akatsushi
Contributor
Contributor

Looking to see if Qlik can provide links to documents within an app. We use a cloud hosting service for documents. And one of our web pages we have made allows us to track documents, and pull from our document management service (dms). However, as we look to retire this website, we are hoping to include it within Qlik, but building out a document tracking app within Qlik pulling data from our database to get the stage of a file, and provide links from our dms.

Is this possible, and what would be the best way to go about it.

Luisanabria
Creator
Creator
Author

Thank you Vinie

 

I was using Sum({<Year={$(=Max(Year))}>} Year<>'2023' but with If, but your solution was usefull. 

As always, thanks