Skip to main content
Announcements
Announcing Qlik Talend® Cloud and Qlik Answers™ to accelerate AI adoption! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Create a diagonal reference line

Hey all,

I am having some troubles to define the expression to create a fix diagonal reference line.

I have a Year-to-date bar chart showing the distribution of revenues per month over a year.

On the chart i have already define a horizontal reference line to define my yearly target revenues (25.000€).

The chart will always shows the 12 months of the year and i would like to create a diagonal reference line going from (0;0) to (Decemeber;25.000€).

Any idea about the expression to define to get this diagonal reference line?

Thank you in advance

5 Replies
prieper
Master II
Master II

You may solve it with an island table with Month and required output.

Else you may add an expression like

=PICK(MONTH(MyDate), 1/12*25000, 2/12*25000, 3/12*25000, .....)

Peter

Anonymous
Not applicable
Author

Hey Peter,

Thank you for reply.

Can you tell me what is an island table?

Regarding you expression, can you explay me the expression a bit?

Thank you in advance

prieper
Master II
Master II

Island-table might be a table within your datamodel, which is not linked to your data. Or might be linked via the date-field (depending your requirements). Syntax

Diagonal: LOAD * INLINE [MyDate, Value

1/1/2017, 2083

1/2/2017, 4167

etc

];

MONTH should deliver a numeric value for for Date, i.e. 1 for January, 2 for February etc. PICK takes the n-th value of this expression, i.e. in case of March it would take 3/12*25000).

Peter

Anonymous
Not applicable
Author

Dear Peter,

I have tried but it didnt seem to work.

Find in attachment the chart that i try to modify.

The only thing that i want to do here, is to create a reference line going from the point (0;0) of my chart and that goes up to 25.000 (other reference line) in december. The reference line needs to be a straight line.

Any idea?

Sergey_Shuklin
Specialist
Specialist

Hi, Arnaud!

This can be done by two ways:

1. Remove Stacked style of bars and create a simple line with expression "month(SnapShotCalendar.MonthYear)*2083";

2. Create a twin of this chart, but with diagonal and make it transparent, then place the twin on top or bottom of the main chart.

The 2nd way may looks slyly, but sometimes it's only way.

Hope it helps!