Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

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
Valued Contributor II

Re: 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 ?

my QVW !

Re: 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 ?

Use something like this...

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

paulyeo11
Valued Contributor II

Re: 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 Manish

Thank you very much for your help.

it work

Paul

Community Browser