Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
nezuko_kamado
Creator
Creator

Delta between the level of Expected and Actual by Year and Month (Subtrack of levels)

How can I create a new table in the load data editor that subtracts the different two levels in one variable?

So that I can have 

Year, Month, Delta
21,  Jan, 8004 (Expected - Actual: 9190-1186 )
21, Feb, -33 ( Expected - Actual :1153-1186)

.... and so on

22, Dec, 48 ( Expected - Actual : :4680-4632)

I just add the parenthesis to show the calculation but don't need it a new table.

 

Dat:
Load* inline[ Year, Month, Value Type
21, JAN, 9109, Expected
21, FEB, 1153, Expected
21, MAR, 1427, Expected
21, APR, 1700, Expected
21, MAY, 1973, Expected
21, JUN, 2216, Expected
21, JUL, 2489, Expected
21, AUG, 2757, Expected
21, OCT, 2642, Expected
21, NOV, 4555, Expected
21, DEC, 6680, Expected
21, SEP, 3036, Expected
21, JAN, 8985, Actual
21, FEB, 1186, Actual
21, MAR, 1447, Actual
21, APR, 1713, Actual
21, MAY, 1954, Actual
21, JUN, 2277, Actual
21, JUL, 2586, Actual
21, AUG, 2886, Actual
21, SEP, 2987, Actual
21, OCT, 1179, Actual
21, NOV, 4113, Actual
21, DEC, 5632, Actual
22, JAN, 8109, Expected
22, FEB, 7153, Expected
22, MAR, 5427, Expected
22, APR, 2700, Expected
22, MAY, 5973, Expected
22, JUN, 3216, Expected
22, JUL, 1489, Expected
22, AUG, 1757, Expected
22, OCT, 1642, Expected
22, NOV, 3555, Expected
22, DEC, 4680, Expected
22, SEP, 2036, Expected
22, JAN, 5985, Actual
22, FEB, 2186, Actual
22, MAR, 2447, Actual
22, APR, 2713, Actual
22, MAY, 2954, Actual
22, JUN, 3277, Actual
22, JUL, 1586, Actual
22, AUG, 1886, Actual
22, SEP, 1987, Actual
22, OCT, 2179, Actual
22, NOV, 2113, Actual
22, DEC, 4632, Actual];

Labels (2)
1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

One way would be:

Dat:
Load* inline[ Year, Month, Value, Type
21, JAN, 9109, Expected
21, FEB, 1153, Expected
21, MAR, 1427, Expected
21, APR, 1700, Expected
21, MAY, 1973, Expected
21, JUN, 2216, Expected
21, JUL, 2489, Expected
21, AUG, 2757, Expected
21, OCT, 2642, Expected
21, NOV, 4555, Expected
21, DEC, 6680, Expected
21, SEP, 3036, Expected
21, JAN, 8985, Actual
21, FEB, 1186, Actual
21, MAR, 1447, Actual
21, APR, 1713, Actual
21, MAY, 1954, Actual
21, JUN, 2277, Actual
21, JUL, 2586, Actual
21, AUG, 2886, Actual
21, SEP, 2987, Actual
21, OCT, 1179, Actual
21, NOV, 4113, Actual
21, DEC, 5632, Actual
22, JAN, 8109, Expected
22, FEB, 7153, Expected
22, MAR, 5427, Expected
22, APR, 2700, Expected
22, MAY, 5973, Expected
22, JUN, 3216, Expected
22, JUL, 1489, Expected
22, AUG, 1757, Expected
22, OCT, 1642, Expected
22, NOV, 3555, Expected
22, DEC, 4680, Expected
22, SEP, 2036, Expected
22, JAN, 5985, Actual
22, FEB, 2186, Actual
22, MAR, 2447, Actual
22, APR, 2713, Actual
22, MAY, 2954, Actual
22, JUN, 3277, Actual
22, JUL, 1586, Actual
22, AUG, 1886, Actual
22, SEP, 1987, Actual
22, OCT, 2179, Actual
22, NOV, 2113, Actual
22, DEC, 4632, Actual];

Delta:
LOAD
Year,
Month,
Value as Expected
Resident Dat
Where Type = 'Expected'
;
Join (Delta)
LOAD
Year,
Month,
Value as Actual
Resident Dat
Where Type = 'Actual'
;
Join (Delta)
LOAD
Year,
Month,
Expected - Actual as Delta
Resident Delta
;

Drop Table Dat; 

 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com