Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dollar expansion in Load statement

Hi,

is it possible to evaluate variable in load statement?

Say

SET vKPI_Fomula = 'sum(Revenue)';

LOAD

                    '$(KPI_Nr)'                                                                                                AS KPI_nr,

                    '=$(=vKPI_Fomula )'                      AS KPI_VALUE,

                    Declaratie_KlantOrganisatie_code  AS KlantOrganisatieId,

                    [Declaratie Year-quarter]                                     AS KPI_QrtrKey

RESIDENT tmpDeclaratie

          GROUP BY Declaratie_KlantOrganisatie_code,

                              [Declaratie Year-quarter];

Thanks,

Dror

1 Solution

Accepted Solutions
swuehl
MVP
MVP

"Dollar-sign expansions are definitions of text replacements used in the script or in expressions", so yes, it is possible.

But I think you need something like

LOAD

                    '$(KPI_Nr)'                                 AS KPI_nr,

                    $(vKPI_Fomula )                      AS KPI_VALUE,

...

since you want QV to evaluate the KPI and not store your literal / string as KPI_VALUE.

Hope this helps,

Stefan

edit:

Maybe remove also the single quotes in your SET statement.

View solution in original post

2 Replies
swuehl
MVP
MVP

"Dollar-sign expansions are definitions of text replacements used in the script or in expressions", so yes, it is possible.

But I think you need something like

LOAD

                    '$(KPI_Nr)'                                 AS KPI_nr,

                    $(vKPI_Fomula )                      AS KPI_VALUE,

...

since you want QV to evaluate the KPI and not store your literal / string as KPI_VALUE.

Hope this helps,

Stefan

edit:

Maybe remove also the single quotes in your SET statement.

Not applicable
Author

Yes, you could do that

Check this code in a separate QVW for an example

set formula = ' sum(id) as mySum ';

test:

LOAD $(formula) INLINE [

id,test

1,aa

2,bb

];

I don't know how useful it will be, as I often use sums etc with group-by clauses...

Perhaps for your requirement it is handy...