Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

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
sunny_talwar

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

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

View solution in original post

4 Replies
sunny_talwar

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

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

marcus_sommer

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
Master
Master
Author

Hi Sunny

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

Paul

Not applicable

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.