Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

double7671
Contributor

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.

Tags (1)
1 Solution

Accepted Solutions
reddys310
Honored Contributor II

Re: a YTD choice

Hi surfman,

Check this out:

Capture.PNG

Check the attached qvf for more details .

#

Thanks and Regards,

Sangram Reddy.

5 Replies
MVP
MVP

Re: a YTD choice

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!


reddys310
Honored Contributor II

Re: a YTD choice

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.

double7671
Contributor

Re: a YTD choice

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.

reddys310
Honored Contributor II

Re: a YTD choice

Hi surfman,

Check this out:

Capture.PNG

Check the attached qvf for more details .

#

Thanks and Regards,

Sangram Reddy.

double7671
Contributor

Re: a YTD choice

fantastic! Much appreciated.

Community Browser