Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Chart Line Style

Hi,

I created a line chart with:

  • Dimensions:
    • Month
    • Metric_Type & ' - ' & Product
  • Expression:
    • =Sum({<Year=, Month=, Year_Month={">=$(=Max(Year_Month)-99) <=$(=Max(Year_Month))"}>}Values)
    • I use this expression so the chart can show the last 12 months (select Year and Month included)


I want to format the "Line Style" of the Expression for the different Metric_Type (SO or SI) using:

  • =if(Metric_Type='SI', '<S1>', '<S3>')

But it doesn't work!!!

But If I use an Expression without Set Analysis like:

     =Sum(Values)

It Works!

Any Suggestions??

Thanks in advance,

Francisco

1 Solution

Accepted Solutions
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Use this.

=if(Only({<Month=,Year=>}Metric_Type)='SI','<S3>')

you have to ignore the fields that your are ignoring in your main expressions.

Also one suggestion...

in your qvw you are refering to mid(product,1,2) in which "product" is a dimension column label. which you can not refer like this as you can do it for expressions.

View solution in original post

12 Replies
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

it will be nice if you share a sample QVW. i dont see a problem in your expressions.

Anonymous
Not applicable
Author

Make sure to write your if statement in the line Style location. I added a picture to show where your expression should be written. Please note that This type of attribute expression only has effect on line, combo and radar charts. but it doesn't work with other type of charts.

Thanks and regards,

Walid

gmoraleswit
Partner - Creator II
Partner - Creator II

Hi Francisco,

Maybe the problem is that in your expression

     =if(Metric_Type='SI', '<S1>', '<S3>')

Metric_Type is not a single value but a set of values, a condition cannot be evaluated comparing a set of values, I suggest to use an aggregation function only(), maxstring(), just be very careful as you are comparing string values.

Here more info: http://community.qlik.com/blogs/qlikviewdesignblog/2014/06/16/use-the-aggregation-functions

IAMDV
Luminary Alumni
Luminary Alumni

Hi Francisco,

Does the Metric_Type field return only value? Also, it will be easy if you can post the sample QVW.

Cheers,

DV

www.QlikShare.com

Not applicable
Author

How can I share the Qvw?

I only see the options Insert Image, video and Link!

Thks,

Francisco

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Whe you hit Reply on top right corner of that editor you will see Advanced Editor. Click on that and that will give you an option to upload QVW.

Not applicable
Author

Hello everyone,

The sample qvw is attached.

Thanks,

FLC

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Use this.

=if(Only({<Month=,Year=>}Metric_Type)='SI','<S3>')

you have to ignore the fields that your are ignoring in your main expressions.

Also one suggestion...

in your qvw you are refering to mid(product,1,2) in which "product" is a dimension column label. which you can not refer like this as you can do it for expressions.

Not applicable
Author

Perfect!

Yes I know about mid(product,1,2), tha was about another issue, but I understand your point...

Thank you.