Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Show Value on Line Chart


I have a line chart of the number of positions in a portfolio over time. The chart is a combo chart with the dimension of date and three expressions. Number of Longs, Number of Shorts and Total.

I ONLY want to see the value on the line chart for each expression at the very latest point. How can I achieve this?

Currently for each expression I have the following under the "Show Value" attribute of each expression: if(Ladder_Date='2014-02-20',1,0). But I don't want to hard code the date in all the time. I want the date to be maximum date in the selection. How can I achieve this in the show value attribute?

8 Replies
marcus_sommer

Try this:

if(Ladder_Date=max(Ladder_Date),1,0).

- Marcus

Anonymous
Not applicable
Author

Thanks Marcus, but when I do that it shows me the value for each date on the line chart. I just want to see it for the latest ladder_date of my selection.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Manish,

It should work if you do:

if(Ladder_Date=max(TOTAL Ladder_Date),1,0)


Steve

Anonymous
Not applicable
Author

Thanks Steve - That seems to work in all scenarios except when nothing is selected. When I clear, I don't see any values. But if I filter on a portfolio or a range of ladder_dates it works perfectly.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

I guess you have dates beyond the end of your data - the TOTAL will take those into account as well.

You could try:

if(Ladder_Date=max({<Long={'<>0'}>}TOTAL Ladder_Date),1,0)


To match only dates that you have values for (assuming you will always have a Long value in the last period on the chart.


Steve

Anonymous
Not applicable
Author

Hmmm....I have all the data, so not sure why it wouldn't display when cleared. It's not a major issue, as something is always selected.

But the next trick is how then would I see over the selected time frame, the Max Expression and the Min Expression, irrespective of where in the timeframe these point lie. The expression being the number of position in this case, but it could be any expression.

So what I want to see is if I select a timefrme of 2013-2014, I want to see on the line chart the values of

Number of Positoins at the end of the timeframe (max Ladder_date)

Max Number of Positions over the timeframe

Min Number of Positions over the timeframe

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

What the expression with the set analysis date is trying to do is check the last date of your line chart.  You could create a text box with the following in to see what date it will try and show the labels for:

=max({<Long={'<>0'}>}TOTAL Ladder_Date)


If the result of that doesn't match the last date of your dimension the expression will need to change.


Positions at the end of timeframe will be something like:


=count({<Ladder_Date={'$(=max({<Long={'<>0'}>}Ladder_Date))'}>} DISTINCT Positions)


The max and min will require Aggr, try:


=max(aggr(count(DISTINCT Positions), Ladder_Date))


=if(min(aggr(count(DISTINCT Positions), Ladder_Date)) = 0,

  min(aggr(count(DISTINCT Positions), Ladder_Date), 2),

   min(aggr(count(DISTINCT Positions), Ladder_Date)))


The extra code on the min is because I presume that you will want to ignore any where the count of Positions is zero?


Hope that helps,

Steve