Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
marco_puccetti
Partner - Creator
Partner - Creator

Conditional Graph

Hello, i need to create a graph (a dimention with date and an expression with a sum of values) that shows the amount of values related to a particular year, i have used this formula that doesn't work:

Sum({<Mid(DATA_PRES,7,4) = {"=$(=ANNO_PRES)"}> }IMPORTO_CERTIFICATI)

In this case the use of Mid is necessary to extract the year part from the date filed, and compare it with the ANNO_PRES field.

The date is a string with this format: dd-mm-yyyy.

Can you explain why the graph is not showed?

Thanks

Marco

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Better to create the value as a field in the load script, and then use that field:

     LOAD

          ...

          Mid(DATA_PRES, 7, 4) As ANNO,

          ...

If ANNO_PRES is a field that contains a single value, or if it is a variable, then use:

     Sum({<ANNO = {'$(=ANNO_PRES)'}> } IMPORTO_CERTIFICATI)

if ANNO_PRES is a field and the compare with ANNO_PRES is a line by line comparison:

     Sum(If(ANNO = ANNO_PRES,  IMPORTO_CERTIFICATI))

HTH

Jonathan

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

View solution in original post

5 Replies
pokassov
Specialist
Specialist

Hi

You cannot use function there

Sum({<Mid(DATA_PRES,7,4) = {"=$(=ANNO_PRES)"}> }IMPORTO_CERTIFICATI)

sunny_talwar

You can try something like this:

Sum({<DATA_PRES = {"=Mid(DATA_PRES, 7,4) = ANNO_PRES"}> } IMPORTO_CERTIFICATI)


HTH

Best,

Sunny

jonathandienst
Partner - Champion III
Partner - Champion III

Better to create the value as a field in the load script, and then use that field:

     LOAD

          ...

          Mid(DATA_PRES, 7, 4) As ANNO,

          ...

If ANNO_PRES is a field that contains a single value, or if it is a variable, then use:

     Sum({<ANNO = {'$(=ANNO_PRES)'}> } IMPORTO_CERTIFICATI)

if ANNO_PRES is a field and the compare with ANNO_PRES is a line by line comparison:

     Sum(If(ANNO = ANNO_PRES,  IMPORTO_CERTIFICATI))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sunny_talwar

I agree, I always try to move the heavy lifting part in the back end of the application as much as possible.

marco_puccetti
Partner - Creator
Partner - Creator
Author

I have added a field to the table to let it compute within a table. In this manner is enaught to use the sum to have the computation.

Thanks

Marco