Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Bar Chart - Default selection on clear to Max(Year)

Hi All,

Below is the expression which I am using. But when clear button is clicked then the default data for max of year should display. how to achieve this?

Count({<Account_Table_ACSAT.Responded={'yes', 'Yes'}, Account_Table_ACSAT.Q2_Score={6,7},Year = {$(=only(Year))},Month=,Quarter=,Day=>} Account_Table_ACSAT.Responded)
/
Count({<Account_Table_ACSAT.Responded={'yes', 'Yes'},Year = {$(=only(Year))},Month=,Quarter=,Day=>} Account_Table_ACSAT.Responded)

Any help would be appreciated.

Thanks in advance!

Regards,

Ankita

7 Replies
sushil353
Master II
Master II

Hi Ankita,

Use Max() or Maxstring()  function instead of only()..

Only() function returns null when there are duplicate of multiple same values

HTH

Sushil

Not applicable
Author

Thanks Sushil!

Apart from this may I know how to make default selection of year, quarter in a calendar to max year and max quarter. whenever application is logged in.

Not applicable
Author

You can add action to select the max year in OnOpen trigger.

Not applicable
Author

Thanks for reply!

Please guide with steps.

But this should clear this selection when clear button is cilcked.


jonathandienst

Hi


No need to mess about with triggers and actions, As per Sushil Kumar's reply this should work:


Count({<Account_Table_ACSAT.Responded={'yes', 'Yes'}, Account_Table_ACSAT.Q2_Score={6,7},Year = {$(=max(Year))},Month=,Quarter=,Day=>} Account_Table_ACSAT.Responded)
/
Count({<Account_Table_ACSAT.Responded={'yes', 'Yes'},Year = {$(=max(Year))},Month=,Quarter=,Day=>}Account_Table_ACSAT.Responded)


Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

1. For On open document defaults:

Settings -> Document Properties -> Triggers -> OnOpen -> Add Action(s) -> Add

Then:

Action type: "Selection"
Action: "select in Field"

Insert in Field: Account_Table_ACSAT.Responded
insert in Search String: Yes

2. For clear buttons / reset buttons to default:

Right click on the button -> properties -> Actions -> Add

Then:

Action type: "Selection"
Action: "select in Field"

Insert in Field: Account_Table_ACSAT.Responded
insert in Search String: Yes

Good practice to "Clear All" or  Enter blanks before values e.g


Insert in Field: Account_Table_ACSAT.Responded
insert in Search String:

a1.JPG

a2.JPG

a3.JPG

Not applicable
Author

I want in calendar year selection as Current Year.

So,I have taken Field as Year and Search String as Max(Year).

But this is not working. When I open the application.