Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
evansabres
Specialist
Specialist

Comparison Expression

I have a data set of historical sales data that has a field called 'aggDAY'. Also in this set is a field called 'aggREV'

I also have a data set of current data with a field called 'DAY' as well as a field called 'REV.'

I want to create a table / chart that has 'DAY' as the dimension, with an expression for SUM(REV) that compares to the aggREV for the given day.

Ideally, i want to create a bar chart that has day across the bottom, with columns showing the rev by day and and a marker showing where that falls in relation to the historical average.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Fact:

LOAD DAY, REV, 'current' as Source

FROM CurrentData;

Concatenate (Fact)

LOAD aggDAY as DAY, aggREV as REV, 'agg' as Source

FROM AggData;

In your chart:

Dimension: DAY

two expressions:

=Sum({<Source = {'current'}>} REV)

=Sum({<Source = {'agg'}>} REV)

View solution in original post

3 Replies
swuehl
MVP
MVP

maybe create a concatenated single table made of your two tables, renaming the aggDay to Day and aggREV to REV and creating a new field that indicates 'agg' resp 'current' data.

This allows you to use DAY as dimension and filter your REV values by the new field.

evansabres
Specialist
Specialist
Author

How do you do that within a script?

swuehl
MVP
MVP

Fact:

LOAD DAY, REV, 'current' as Source

FROM CurrentData;

Concatenate (Fact)

LOAD aggDAY as DAY, aggREV as REV, 'agg' as Source

FROM AggData;

In your chart:

Dimension: DAY

two expressions:

=Sum({<Source = {'current'}>} REV)

=Sum({<Source = {'agg'}>} REV)