Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

year quarter

Hi guys,

i have year and yearquarter field

one pie chart one bar chart with sum(sales)

so my requiremment is wenever i clear all it wil display the max year higest quarter value for that what can i do

can anyone give me the suggestions.

my fileds

year     yearquarter

                                            

2000     2000Q1,2000Q2,2000Q3,2000Q4

2001     2001Q1,2001Q2,2001Q3,2001Q4

2002     2002Q1,2002Q2,2002Q3,2002Q4

2003     2003Q1,2003Q2,2003Q3,2003Q4

result wil be lik

display 2003Q4 sales.

Thank you

Suresh

1 Solution

Accepted Solutions
sunny_talwar

Pie chart like this? (PFA)

Capture.PNG

View solution in original post

10 Replies
sunny_talwar

You can probably use an if statement.

If(GetSelectedCount(Selection) = 0, Sum({<yearquarter = {'2000Q1'}>} Sales), Sum(Sales))

HTH

Best,

Sunny

sasiparupudi1
Master III
Master III

Please post your qvw

MK_QSL
MVP
MVP

=IF(IsNull(GetCurrentSelections()),SUM({<yearquarter = {"$(=MaxString({<year = {$(=Max(year))}>}yearquarter))"}>}sales), sum(sales))

avinashelite

Hi Suri,

When none of the selection are made and if you want the highest year and Quarter to be displayed then you can follow  sunindia‌ suggestion . If you want the selection to be set for highest only on the clear selection event then its not possible

Anonymous
Not applicable

goto your sheet properties (the sheet which contains your Charts) and define the trigger

select field yearquarter with =maxstring({1}yearquarter)

define the macro

sub DefineClearState
ActiveDocument.SetClearState
end Sub

at last Action in sheet Trigger define

run macro DefineClearState

whenever you press the clear button it will select the latest yearquarter

Chanty4u
MVP
MVP
Author

Hi

thank you for ua response.

Plase find the attached qvw.

wit in dat i want to display wenever i clear all the values display the max year curren quarter value

Thank you

Suresh

sunny_talwar

You data is somewhat different, but the attached qvw seems to work.

Capture.PNG

Chanty4u
MVP
MVP
Author

hi sunindia,

thanks it works fine .

bt wen i clear all  in text box it is showng later year quarter. but  in chart i want to display sum (sales)

and in  i want one pie chart in same page  disply sum(sales) per year

sunny_talwar

Pie chart like this? (PFA)

Capture.PNG