Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

ankit777
Valued Contributor

Conditionally creating a line chart.

Hi All,

I have a table.

CategoryPointScoreDate
Northa7March 20, 2014
Northa6March 21, 2014
Northa5March 22, 2014
Northb7March 20, 2014
Northb9March 21 2014
Northb4March 22 2014
Southc3March 20, 2014
Southc5March 21 2014
Southc7March 22 2014
Southd8March 20 2014
Southd9March 21 2014
Southd7March 22 2014

I want to create a line chart in which I want to show the date wise score of all the point in a particular category when user selects that category. For example

If user selects North, he should see the trend for point a and b in the line chart.

If user selects South, he should see the trend for point c and d in the same chart.

Please help.

Thanks

1 Solution

Accepted Solutions

Re: Conditionally creating a line chart.

Like this?

8 Replies

Re: Conditionally creating a line chart.

Like this?

Re: Conditionally creating a line chart.

I'm not sure what you mean by trendlines. Are those simply the lines themselves or the lines you get when you enable for example the linear option under Trendlines (on the Expressions tab). See attached example


talk is cheap, supply exceeds demand
ankit777
Valued Contributor

Re: Conditionally creating a line chart.

Hi Manish,

Thanks for your reply. It exactly meets my requirement. But can you explain why are you using sum function?

ankit777
Valued Contributor

Re: Conditionally creating a line chart.

HI,

The chart you provided is correct. Please explain the use of sum() function.

Re: Conditionally creating a line chart.

Hi,

If there are many values for a particular combination of dimension then it will result you in "Null". If use sum around that field name then it will add up and show you the consolidated value for that combination.

MVP
MVP

Re: Conditionally creating a line chart.

Hi Ankit,

You need to use Aggregate functions like Sum, Count etc in Expressions to the get value by the dimensions.   For single date and point you have multiple scores, if you want to get by  Date and Point then you have to use Sum(Score) and use the dimensions date and point.  Sum() is similar to Group by in SQL

SELECT

date,

point,

Sum(score)

FROM TableName

Group By date, point;

Hop this helps you.

Regards,

Jagan.

ankit777
Valued Contributor

Re: Conditionally creating a line chart.

Thanks everyone.

Re: Conditionally creating a line chart.

SUM is used considering the possibilities that there could be more than one different score for same category, point and date combination...

Community Browser