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: 
paulyeo11
Master
Master

How to have SET expression if not select any date it will display YTD amount Jan till july amount , if select year=2016 and month =12 it will display Jan till Dec Amount ?

Hi All

I have Below expression (A) work fine :-

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/Rate)

I like above expression when using in QS , user don't need to select any month and year , it will display YTD amount.

After using above expression , user compliant that now when they need to view the Jan till Dec 2016 amount , (when i click on blue button , it does not able to display any value.)

So i change the above to expression (B) sa below, By remove sales = {'*'} from above expression.

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}>} month))"}>}sales_target/Rate)

Now my issue is if i using the above Expression B in QS , when user log in to the page , they need to select month = 6 and year = 12 in order to view the YTD target amount.

it there any short cut that allow me when not select any date , it will display YTD target , when select month =12 year = 2016 , it will display sales target from jan till dec amount ?

Paul

3 Replies
paulyeo11
Master
Master
Author

my QVW !

MK_QSL
MVP
MVP

Use something like this...

SUM({<year = {'$(=Max(year))'}, month = {"<=$(=IF(GetSelectedCount(month), Max({<year = {'$(=Max(year))'}>}month), Num(Month(Today()))))"}>}sales_target/Rate)

paulyeo11
Master
Master
Author

Hi Manish

Thank you very much for your help.

it work

Paul