Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
See why BI users voted Qlik #1 in 11 categories. GET REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Compare Values

Hi tell me please how to compare Sum (##) by year in the same table, thank you in advance 

Vittore8_0-1587997637884.png

 

Labels (1)
6 Replies
Highlighted
Creator III
Creator III

remove year as dimension, you can get the values as

sum({<yearfield={2018}>}somefield), 

 

sum({<yearfield={2017}>}somefield)

 

if you want to keep year as dimension and of expression as some other year

sum(Total<A,B,C>{<yearfield={2017}>}somefield) where A,b,C are all  fields in dimension list other than year

Highlighted
Creator
Creator

I'm sorry, that's not how I phrased the question.

Vittore8_1-1588009063973.png

 

Result: 2018 A 20

How can I compare values from the same table (2017 B 15 > 2018 B 3 --  yes, since 15 > 3, so we don't include it in the result set). For example, left join, but use set analysis

Highlighted
Digital Support
Digital Support

@Vittore8,

 

Have you already found this thread Comparing values in the same table?
Would this solution be what you are looking for?

 

 

 

 

To help users find verified answers, please don't forget to mark a correct resolution or answer to your problem or question as correct.
Highlighted
Digital Support
Digital Support

Hi @Vittore8 are you still facing the same problem?
Please let us from Community know, so we can help you.

To help users find verified answers, please don't forget to mark a correct resolution or answer to your problem or question as correct.
Highlighted
Specialist III
Specialist III

One solution is.

tab1:
LOAD * INLINE [
    Yr, ID, Value
    2017, A, 10
    2017, B, 15
    2018, A, 20
    2018, B, 3
];

tab2:
LOAD ID, Yr As Yr1, Value as V1
Resident tab1
Where Yr=2017;

Left Join(tab2)
LOAD ID, Yr As Yr2, Value as V2
Resident tab1
Where Yr=2018;

tab3:
NoConcatenate
LOAD *, If(V1>V2, 'Yes', 'No') As Result
Resident tab2;

Drop Table tab1, tab2;
Highlighted
Specialist III
Specialist III

Output

commQV58.PNG