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

Calculating percentage of two selections of the list box

Hello everyone,

I'm trying to calculate the percentage of two selections (in this case, years, months, weeks).

The expression is: (year with the less value divided by year with the high value)-1

This years are listed on a list box, how can i do it? 😕

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

HI,

Try like this

=(RangeMin(Sum({$ <YearFieldName={'$(=Min(YearFieldName))'}>}  MeasureName),

Sum({$ <YearFieldName={'$(=Max(YearFieldName))'}>}   MeasureName))/

RangeMax(Sum({$ <YearFieldName={'$(=Min(YearFieldName))'}>}  MeasureName),

Sum({$ <YearFieldName={'$(=Max(YearFieldName))'}>}   MeasureName))) - 1


Hope this helps you.


Regards,

Jagan.

View solution in original post

7 Replies
maxgro
MVP
MVP

maybe

sum({$ <year={'$(=min(year))'}>}  somefield)

/

sum({$ <year={'$(=max(year))'}>}   somefield)

-1

swuehl
MVP
MVP

Maybe like

=FirstSortedValue(DISTINCT Year, Year) / FirstSortedValue(DISTINCT Year, -Year) -1

edit:

If you've selected more than two values or all values possible, this should consider highest two:

=FirstSortedValue(DISTINCT Year, -Year,2) / FirstSortedValue(DISTINCT Year, -Year) -1

and this lowest two:

=FirstSortedValue(DISTINCT Year, Year) / FirstSortedValue(DISTINCT Year, Year,2) -1

amayuresh
Creator III
Creator III

Try this expression

=num(sum({<Order_Year={'$(=Min(Order_Year))'}>}TotalDue)/sum({<Order_Year={'$(=Max(Order_Year))'}>}TotalDue),'#,##0%')

jagan
Luminary Alumni
Luminary Alumni

HI,

Try like this

=(RangeMin(Sum({$ <YearFieldName={'$(=Min(YearFieldName))'}>}  MeasureName),

Sum({$ <YearFieldName={'$(=Max(YearFieldName))'}>}   MeasureName))/

RangeMax(Sum({$ <YearFieldName={'$(=Min(YearFieldName))'}>}  MeasureName),

Sum({$ <YearFieldName={'$(=Max(YearFieldName))'}>}   MeasureName))) - 1


Hope this helps you.


Regards,

Jagan.

Not applicable
Author

What kind of graph do you recommend me to do this, btw the expression does not recognize the years. But i suppose the problem is me.. hehe

Not applicable
Author

Actually, i set the expression as a title, and it recognize the years just i want, but i don't know what it means TotalDue, is the name of the column that shows the results?

What kind of graph or form do you recommend me?

Not applicable
Author

tyvm, it worked, i was making a big mistake but i saw it and it worked.

Regards

Jorge