Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
paulyeo11
Valued Contributor II

GP % expression how to make it with out select current mth and yr ?

Hi All

I have beow expression at table 1 working fine , when i select current month and year :-

(

sum({$<year=, month=, date = {">=$(=MonthStart(vSelectedDate, -48))<=$(=vSelectedDate)"}>} sales/$(Columndim89))/1

-

sum({$<year=, month=, date = {">=$(=MonthStart(vSelectedDate, -48))<=$(=vSelectedDate)"}>} cost/$(Columndim89))/1

)

/

sum({$<year=, month=, date = {">=$(=MonthStart(vSelectedDate, -48))<=$(=vSelectedDate)"}>} sales/$(Columndim89))/1

Can some one share with me how to make the above expression still working when i not select current month and current year ?

Now Table 2 not working fine , because of above expression need to modify.

Paul

1 Solution

Accepted Solutions

Re: GP % expression how to make it with out select current mth and yr ?

May be change the expression for the variable vSelectedDate to this:

=MonthEnd(MakeDate(Max({<sales = {'*'}>}year), Max({<sales = {'*'}, year = {$(=Max(year))}>} month),1))

4 Replies

Re: GP % expression how to make it with out select current mth and yr ?

May be change the expression for the variable vSelectedDate to this:

=MonthEnd(MakeDate(Max({<sales = {'*'}>}year), Max({<sales = {'*'}, year = {$(=Max(year))}>} month),1))

Re: GP % expression how to make it with out select current mth and yr ?

Your variable vSelectedDate could be changed to max(DATE) which will be return a value if nothing is selected and if some value(s) are selected it returns the max. value from the selected values.

- Marcus

paulyeo11
Valued Contributor II

Re: GP % expression how to make it with out select current mth and yr ?

Hi Sunny

Thank you for your help. there are some thing wrong in my org expression. I need to settle first.

Paul

Not applicable

Re: GP % expression how to make it with out select current mth and yr ?

Finally my chart GP % value is correct. I ever once have chart display wrong value because i click on null dimension , and no one have detect this mistake for 5 yr.

Community Browser