Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Showing line based on selection

Hi All,

I want to show line style for ySales based on the selection.

By default it will show max year data and ySales will show dotted line from AUG to DEC as xSales will be zero from SEP.

My requirement is :

When Feb is selected, JAN should show line, and remaining months dotted line.

When Feb is selected, JAN,FEB should show line, and remaining months dotted line.

When Mar is selected, JAN,FEB,MAR should show line, and remaining months dotted line.

.

.

.

By default, JAN it is showing correct. But when I select FEB, JAN data is showing dotted line, FEB line, remaining Months line.

I want JAN,FEB should be dotted line.

I am using this Line Style formula:

If(Month<vMaxDate,'<S1>','<S4>')

Please help me.

Issue:

Capture.PNG

Requirement:

Capture.PNG

Load * inline [

Month,xSales,ySales

JAN-16,10,15

FEB-16,20,25

MAR-16,30,35

APR-16,40,45

MAY-16,50,55

JUN-16,60,65

JUL-16,70,75

AUG-16,80,85

SEP-16,,95

OCT-16,,105

NOV-16,,125

DEC-16,,135

];

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Variable:

vSelectedDate = Date(If(Max(Date) < vMaxDate, Max(Date), vMaxDate))

Expression:

SUM({$<Year={$(=max(Year))},Month=,MonthName=, Date={'<=$(=vSelectedDate)'}>}xSales) +

SUM({$<Year={$(=max(Year))},Month=,MonthName=, Date={'>$(=vSelectedDate)'}>}ySales)

Background Color Expression:If(Only({<Year={$(=max(Year))},Month=,MonthName=, Date={'<=$(=vSelectedDate)'}>} Date), RGB(0, 255, 0), RGB(0, 0, 255))

Line Style Expression: If(Only({<Year={$(=max(Year))},Month=,MonthName=, Date={'<=$(=vSelectedDate)'}>} Date), '<S1>', '<S2>')

Regards,

Jagan.

View solution in original post

14 Replies
sunny_talwar

Try this expression for line style:

If(Only({1}Month)<=Max(TOTAL Month),'<S1>','<S2>')


Capture.PNG

Not applicable
Author

Hi Sunny,

Thank you for the reply.

Please help me for default selection for no Year,Month selection as below:

Capture.PNG

sunny_talwar

May be this:

If(Only({1}Month)<=Max(TOTAL Month) and Below(Sum({$<Year={$(=max(Year))},Month,MonthName>}xSales)) > 0,'<S1>','<S2>')

No selection

Capture.PNG

With March selected

Capture.PNG

Not applicable
Author

I am trying with this . But not working. Please help me.

If(Month<vMaxDate and GetSelectedCount(Year)=0,'<S1>',

if(GetSelectedCount(Year)>0 and Month<vMaxDate ,'<S1>',

If(Only({1}Month)<Max(TOTAL Month),'<S1>',

'<S2>')))

Not applicable
Author

You are great sir

Anil_Babu_Samineni

Does vMaxDate is a variable? If yes, you need to use this

$(=vMaxDate)

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
sunny_talwar

What is the goal here Jack? I can only interpret your code for the words written in it, what are your trying to do here?

Not applicable
Author

Sunny, your formula is working for the dummy date. Can we try in other way please?

Not applicable
Author

Hi Anil, It is a variable.It is not working