Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ratier
Contributor III
Contributor III

Greatest value becoming smallest

I Have a Build Up Chart that goes from the "Programmed Values" to the "Real Values" and when the first one is greater than the second one, my data must change so that:

Programmed 50
A 2
B 3
C 4
D -5
E 8
F 20
Real 82

 

Becomes:

Programmed 50
A 8
B 4
C 3
D 20
E 2
F -5
Real 82

 

What I did was change the order. For exemple, the greatest value (20) was assigned to F but now the lowest value is. The same goes to the second greates (8), assigned to E. The second lowest (2) is now assigned to E.

How can I reassing values in Qlik Sense like that?

Labels (5)
1 Solution

Accepted Solutions
Rams-
Creator
Creator

Hi you share your expression!!!

View solution in original post

3 Replies
Rams-
Creator
Creator

Hi you share your expression!!!

Ratier
Contributor III
Contributor III
Author

Got It by myself but I thank you for the help

I created 6 variables:

  • vA=Formula of Measure A
  • vB=Formula of Measure B
  • vC=Formula of Measure C
  • vD=Formula of Measure D
  • vE=Formula of Measure E
  • vF=Formula of Measure F

Then, for exemple, to change the value of vB based on it's rank among A,B,C,D,E and F, I used:

  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),1),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),6),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),2),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),5),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),3),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),4),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),4),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),3),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),5),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),2),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),6),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),1)
  • ))))))

 

Using the same formula for vA,vC,vD,vE and vF but changing the variable in red to the corresponding one, I can reverse the values as I intended:

  • greatest value changing to the lowest value among the 6.
  • 2th greatest value changing to the 2th lowest value among the 6.
  • and so on...
Ratier
Contributor III
Contributor III
Author

Accept as Solution

Got It by myself but I thank you for the help

I created 6 variables:

  • vA=Formula of Measure A
  • vB=Formula of Measure B
  • vC=Formula of Measure C
  • vD=Formula of Measure D
  • vE=Formula of Measure E
  • vF=Formula of Measure F

Then, for exemple, to change the value of vB based on it's rank among A,B,C,D,E and F, I used:

  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),1),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),6),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),2),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),5),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),3),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),4),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),4),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),3),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),5),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),2),
  • If('$(=$(vB))'=Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),6),Max(ValueList('$(=$(vA))','$(=$(vB))','$(=$(vC))','$(=$(vD))','$(=$(vE))','$(=$(vF))'),1)
  • ))))))

 

Using the same formula for vA,vC,vD,vE and vF but changing the variable in red to the corresponding one, I can reverse the values as I intended:

  • greatest value changing to the lowest value among the 6.
  • 2th greatest value changing to the 2th lowest value among the 6.
  • and so on...