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: 
ColdSpark
Contributor
Contributor

Sum if across tables

Hello, I’m relatively new to Qlik but have an app now with a table of raw data about 1000 records. 
each record has a period_start_date field and an associated $ amount of value. 

in a second table that I’ve created with the load editor, I have a date in each month going forward a year (dynamically created with addmonth). 

I want to be able to add a column to my second table that returns the sum of the $ value for any record where it’s period_start_date falls within the month of the date in the second table. 

assuming I need a join here? Would l

Labels (1)
1 Solution

Accepted Solutions
Ahidhar
Creator III
Creator III

you don't need to use sumifs try this ,

Table1:
load date#(period_start_date,'DD-MM-YYYY') as period_start_date,Amount
Inline
[
period_start_date ,Amount
15-09-2023 , 21651465
16-09-2023 ,3212
10-10-2023 ,3321
30-10-2023 ,454566
11-11-2023 ,2546
13-11-2023 ,2246
14-11-2023 ,668863
];
NoConcatenate
Table2:
load Month,sum(Amount) as Result group by Month;
load
date(monthstart(period_start_date),'DD-MMM-YY') as Month,
Amount
resident Table1 ;

Ahidhar_0-1703759539609.png

 

View solution in original post

4 Replies
vincent_ardiet_
Specialist
Specialist

If you add a new column with end of month, you could maybe use intervalmatch?

ColdSpark
Contributor
Contributor
Author

Thanks Vincent, in this case though I want to essentially run what would be a SUMIFS in excel so I'm not sure interval match would work in this case? I've attached an excel file showing what I'd like to achieve to hopefully help folks understand where I'm at!

 

 

vincent_ardiet_
Specialist
Specialist

For me this should work, you add a period_end_date column in your raw data table like:
MonthEnd(period_start_date) as period_end_date

And then you can use interval match to join your table Months.

An other quick win solution could also be to just add a month field to your raw data table:
MonthStart(period_start_date) as Month

Ahidhar
Creator III
Creator III

you don't need to use sumifs try this ,

Table1:
load date#(period_start_date,'DD-MM-YYYY') as period_start_date,Amount
Inline
[
period_start_date ,Amount
15-09-2023 , 21651465
16-09-2023 ,3212
10-10-2023 ,3321
30-10-2023 ,454566
11-11-2023 ,2546
13-11-2023 ,2246
14-11-2023 ,668863
];
NoConcatenate
Table2:
load Month,sum(Amount) as Result group by Month;
load
date(monthstart(period_start_date),'DD-MMM-YY') as Month,
Amount
resident Table1 ;

Ahidhar_0-1703759539609.png