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: 
Not applicable

Set Analysis Issue : Compare Fields between two tables


T1.Year and T1.Month Field is available in Table1

T2.Year, T2.Month and T2.Budget is available in Table 2

Now, These tables are not linked with each other. T1.Year and T1.Month are the filters in the Dashboard. If no Year and Month is selected the expression should give me sum of all Budget for the Year and Month present in Table1. If a Year or Month is selected Table2 should fetch the Budget only for the selected Year and Month.

Expression Used:

sum( {<T1.Year={"=T1.Year=T2.Year"}, T1.Month={"=T1.Month=T2.Month"}, >} T2.Budget)

Can anybody please help me with a suitable solution for this

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I hope your data set is very small, otherwise this structure will perform poorly or not at all. Expressions with fields from unassociated tables require QV do a cartesian join between the two tables. For example, if they each contain 10,000 rows, the join will be 100 million rows.

Either create a selection in the budget table, concatenate T1 and T2, or join the tables by using common Year, Month fields (or a YearMonthKey if you don't want a synthetic key)

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
timanshu
Creator III
Creator III

If T2 contains Month and Year , then why don't you use these fields as filter??

If you still want Sum of budget to be filtered on T1.Year and T1.Month selection , then you can rename T2.Year and T2.Month as T1.Year and T1.Year respectively.

petter
Partner - Champion III
Partner - Champion III

The field on the left-hand-side of the equal sign has to be a unique identifier for the table in question or the the comparison will fail. So you don't need to repeat the T1.Year you should rather write T1.ID (or whatever field is a unique identfier).

As Jonathan points out this might be a very costly operation when it comes to performance - so be careful.

Sum( { <T1.ID={ "=T1.Year=T2.Year AND T1.Month=T2.Month" } > } T2.Budget )