Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

a YTD choice

Now I have a bar chart in QLIK SENSE shows this year and last year sales data.As default, the graph will show this year YTD data and whole last year data.

I want to offer a choice to user to pick YTD data, once YTD was picked, the graph will show this year YTD data (same as default) and same period data in last year.

Can any help on how to achieve this goal? especially how to provide the YTD choice and how to interact with it. thanks.

1 Solution

Accepted Solutions
reddy-s
Master II
Master II

Hi surfman,

Check this out:

Capture.PNG

Check the attached qvf for more details .

#

Thanks and Regards,

Sangram Reddy.

View solution in original post

5 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Usually we create conditional flags, such as a CYTD_Flag that are assigned 0 or 1, depending on the condition. With the flag pre-calculated in the data load script, it's easy to select the YTD and the Last YTD data using Set Analysis:

sum({<CYTD_Flag = {1}>}  Sales) -

sum({<LYTD_Flag = {1}>}  Sales)


cheers,

Oleg Troyansky

Take your Qlik Skills to the next level at the Masters Summit for Qlik - now with new and redesigned materials!


reddy-s
Master II
Master II

Hi Sufman,

In Script

You can set the Current year to date flag using :

inyeartodate(Date,today,0) * (-1) as CYTD  - this will flag (1) if the date falls in the current year to date period.

You can set the Current year to date flag using :

inyeartodate(Date,today,-1) * (-1) as LYTD  - this will flag (1) if the date falls in the last year to date period.

Use these flags in the set analysis expressions.

sum({<CYTD_Flag = {1}>}  Sales) -

sum({<LYTD_Flag = {1}>}  Sales)

Thanks,

Sangram Reddy.

Anonymous
Not applicable
Author

Thanks for both of answers. I still have question on how to implement on UI. is that possible show me a simple sample?

I am new and much appreciated your elaboration.

reddy-s
Master II
Master II

Hi surfman,

Check this out:

Capture.PNG

Check the attached qvf for more details .

#

Thanks and Regards,

Sangram Reddy.

Anonymous
Not applicable
Author

fantastic! Much appreciated.