Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FirstSortedValue in Line Chart

HI.

I'm trying to use this function to retrieve the firstsortedvalue of revenue expression, in a line chart, with Date and Customer dimensions.

Basically, I want the value to be the first one shown in the chart with respect to the other parameters chosen.

The overall idea here is to divide each month's revenue by the first sorted value's revenue, to achieve % change.

But I can't get the firstsortedvalue to work properly.

Here is my syntax, which clearly has problems because it does not retrieve any data.

=$(vPremiumRevenue) / FirstSortedValue($(vPremiumRevenue), [MonthYear], [Customer Name])

Any idea what I'm doing wrong here?

Thanks!

17 Replies
Not applicable
Author

Actually, it retrieves data, but not anything for the firstsortedvalue. It only retrieves the actual (vPremiumRevenue).

Clever_Anjos
Employee
Employee

FirstSortedValue expects 3 parameters

1) Value to be sorted

2) Weight of sorting

3) Ranking (1,2,3...)

You´re passing Customer Name as ranking parameter

Another point is if two values share same weight,NULL is returned, you have to choose a unique weight (maybe adding another field)

MK_QSL
MVP
MVP

your expression looks wrong in terms of FirstSortedValue.

If possible, please attach your file for better solution

Not applicable
Author

Unfortunately I can't attach the file. Work stuff.

I'm really a beginner to this -- just learning set analysis now.

How should I write the expression?

I have two dimensions in the line chart--MonthYear and Customer Name.

And one Expression -- the variable of vPremiumRevenue.

It's very simple right now, just showing each Customer's revenue per month/year

Anything else i could do instead of upload the file?

MK_QSL
MVP
MVP

What output you want? Can you give one example in excel or table with sample data...

Clever_Anjos
Employee
Employee

What do you expect? Maybe Max() or Min()?

Clever_Anjos
Employee
Employee

If you want the first value, TOP($(vPremiumRevenue)) will retrieve it

Not applicable
Author

QlikView

This demo file has a good example of what I'm looking for.

It's really Revenue % Change over time.

So If the User selects 2013, and Jan-Dec,  the chart will use January's Revenue as the firstsortedvalue, and the expression will divide each subsuquent calculation of revenue by that number.

As an example:

ABC, Co

Jan revenue = $150

Feb Revenue = $100

Mar Revenue = $200

So in the line chart, ABC Co. would show 100% for Jan,   67% for Feb, and 133% for March.

Feb and March calculations should be relative to the firstsortedvalue, which is the Jan revenue.

I don't know if i'm explaining this very well. But the linked doc shows it very close to what i need to achieve.

Thanks for the replies.