Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rcandeo
Creator III
Creator III

how to show this expression?

I have to put a KPI inside a text box showing the country that has the most growth comparing actual year x prior year.

I use this expression below in a chart straight table and it works using a dimension limits for 1 largest value.

(sum({<[Year] = {'$(vCurrentYear)'}>} amount) - sum({<[Year] = {'$(vPriorYear)'}>} amount))

/

sum({<[Year] = {'$(vPriorYear)'}>} amount)

But how to put this expression showing the Country as below without having the dimension limits for largest valeu, as this is not a chart table anymore?

China - 23.42%

1 Solution

Accepted Solutions
sunny_talwar

How about this:

FirstSortedValue(Country, -Aggr(

(sum({<[Year] = {'$(vCurrentYear)'}>} amount) - sum({<[Year] = {'$(vPriorYear)'}>} amount))

/

sum({<[Year] = {'$(vPriorYear)'}>} amount),

Country))

View solution in original post

10 Replies
Anonymous
Not applicable

Hi

Use Rank function

sunny_talwar

How about this:

FirstSortedValue(Country, -Aggr(

(sum({<[Year] = {'$(vCurrentYear)'}>} amount) - sum({<[Year] = {'$(vPriorYear)'}>} amount))

/

sum({<[Year] = {'$(vPriorYear)'}>} amount),

Country))

agomes1971
Specialist II
Specialist II

Hi,

try

= yourcountryfield & ' - ' &

num((sum({<[Year] = {'$(vCurrentYear)'}>} amount) - sum({<[Year] = {'$(vPriorYear)'}>} amount))

/

sum({<[Year] = {'$(vPriorYear)'}>} amount), #.##0,00%)

HTH

André Gomes

antoniotiman
Master III
Master III

Hi,

try

FirstSortedValue(DISTINCT Country,-Aggr(YourExpression,Country))

Gysbert_Wassenaar

Perhaps like this:

vExpr1: sum({<[Year] = {'$(vCurrentYear)'}, >} amount)/sum({<[Year] = {'$(vPriorYear)'}>} amount) - 1

=Only({<Country={"=rank($(vExpr1))=1"}>}Country) & ' - ' &

  num( sum({<[Year] = {'$(vCurrentYear)'}, Country={"=rank($(vExpr1))=1"}>} amount)/sum({<[Year] = {'$(vPriorYear)'}, Country={"=rank($(vExpr1))=1"}>} amount) - 1 ,'0.00%')


talk is cheap, supply exceeds demand
rcandeo
Creator III
Creator III
Author

This gave the country, but I am not being able to show the number beside, can you help me again?

Gysbert_Wassenaar

use max instead of firstsortedvalue and remove the first argument and the comma of course and the minus ( - ) character.


talk is cheap, supply exceeds demand
rcandeo
Creator III
Creator III
Author

I had a null value in this expression, but thank you for all

rcandeo
Creator III
Creator III
Author

Thank you very much