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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
yogitamehta10
Creator
Creator

Defualt slction in bar graph

Hi All,


I just have one small issue ,

I have year dimension (listbox) that has three  field Last year, current year and Last cycle.

i want  my bar graph to set condition if nothing is selected then show last year data  other depending upon user selection from filter.

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Not really sure, What your intend here

If(GetFieldSelections(Year)>0, Sum(Sales), Sum({<Year = {'last year'}>} Sales))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

5 Replies
Anil_Babu_Samineni

Simply do this? Change accordingly

If(GetFieldSelections(Year)>0, Sum(Sales), Sum({<Year = {'$(=Max(Year-1))'}>} Sales))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
yogitamehta10
Creator
Creator
Author

but in your expression we are not  giving  by default Last year data  otherwise depending upon user selection.

and my year field is basically character that says last year , current year or last cycle

Anil_Babu_Samineni

Not really sure, What your intend here

If(GetFieldSelections(Year)>0, Sum(Sales), Sum({<Year = {'last year'}>} Sales))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
its_anandrjs
Champion III
Champion III

Better you can do this way by writing two expressions and use a conditinal option in bar chart expressions.

Expression1:-

=SUM(Sales)

And

Conditional:-

=GetSelectedCount(Year)=1

Expression2:-

=Sum({<Year = {'$(=Max(Year-1))'}>} Sales)

And

Conditional:-

=GetSelectedCount(Year)=0

yogitamehta10
Creator
Creator
Author

Apologies I got it , seems like I'm not in working mood:)