Hi, I'm new. I'm trying to learn qlik to use it at work... Just now I'm using qlik cloud but I'll use qlik enterprise in the future so I need general solutions and just script-related since I will be dealing with massive databases. For now... I'm trying to detect outliers but I think the problems is more with my comprehension of expansions.
test: LOAD codfis, imposta1, tassa2, grandezza3, valore150 FROM [lib://DataFiles/tabellatest.xlsx] (ooxml, embedded labels, table is Foglio1);
let campo = 'codfis'; let tabella = 'test'; let id = '$(tabella)'&'$(campo)';
sub proc($(id),$(tabella),$(campo))
//the mistake is in the following statement, if I don't use expansions but codfis, imposta1 etc it works just fine. I tried using let statements before but it returns an error (as it were nothing in their place) when I try to load them
diff'$(camp)':
load (fractile($(camp), 0.99)- fractile($(camp), 0.25)+1) as dif'$(camp)'
resident '$(tabella)';
outlier: load
count($(campo)) as numero resident '$(tabella)'where $(campo) > 1000*dif'$(camp)'; end sub; call out ($(camp));
let camp = imposta1; call out ($(camp)); end sub;
I tried again doing it in the big for each cycle... Now the first part works (Idk why, I just copied the one that didn't) but then the error message board tells me that it can't find the field 'a' (... I have no field a, I checked the grafical variables too) and shows me "where $(campo) > 1000*$(dif);" as "where $(campo) > 1000* "
test: LOAD codfis, imposta1, tassa2, grandezza3, valore150 FROM [lib://DataFiles/tabellatest.xlsx] (ooxml, embedded labels, table is Foglio1);
let campo = 'codfis'; let tabella = 'test'; let id = '$(tabella)'&'$(campo)';
sub proc($(id),$(tabella),$(campo))
for each campo in 'codfis','imposta1','tassa2','grandezza3','valore150'; let tabella = 'test'; let id = '$(tabella)''_''$(campo)';
diff: load (fractile($(campo), 0.99)- fractile($(campo), 0.25)+1) as dif resident '$(tabella)'; outliers: load '$(id)' AS id, '$(tabella)' as tabella, '$(campo)' as campo, count($(campo)) as numero resident '$(tabella)' where $(campo) > 1000*$(dif); next; end sub;