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: 
danosoft
Specialist
Specialist

Hidden value in a table

Hi i have a table with some column, i want display the value of coloum SOURCING only when my YEAR is 2017, when year is < 2107 i want display in this column the value 0

Is possible to do that in a table?

thanks

1 Solution

Accepted Solutions
pradosh_thakur
Master II
Master II

LOAD

    ANNO,

     SOURCING,

     if(SOURCING=2017,SOURCING,0) as SOURCING_COPY

SQL SELECT *

FROM "XXX"."V_XXX_16_17";

As per your condition sourcing should be 2017 or else zero.. so check that then do it. make sure you write field name properly

Learning never stops.

View solution in original post

8 Replies
YoussefBelloum
Champion
Champion

Hi Daniele,

you can do this by using a condition in the dimension, try this:

=if(date < YearEnd(today()), date, 0)


if you have only a field year in your model, you can filter directly on the year:


=if(Year = year(today()), year, 0)


danosoft
Specialist
Specialist
Author

Hi, sorry but is not a GRAPH object is a Table object, i not have dimension

YoussefBelloum
Champion
Champion

A table box does not support calculations.

What can you do is select that field based on a button or trigger or try to make specific calculations on the script.

danosoft
Specialist
Specialist
Author

Sorry i understand that i can't do that, but i not understand what you mean for "based on a button or trigger" or making specific calculation on a script... how can i do that?

YoussefBelloum
Champion
Champion

You can use a button to make a selection of the year you want, so the table will update on that selection.

you can also create a trigger that can be launched on multiple things, like when you open the app, when you open a sheet, etc...

about the calculation on the script: you can use a second load with a "where" condition for the year you want and concatenate this load on the first table.

tell me if it is clear.

Regards,

Youssef

pradosh_thakur
Master II
Master II

This is easy to do with  a straight table but with table box it is hard may be not possible.

but one workaround you can do is by adding an extra column in the model sourcing_copy

sourcing_copy expression ->if(sourcing=2017,sourcing,0) as sourcing_copy

in place of 2017 you can get the current year using function.

hope this helps.


Regards

Pradosh

Learning never stops.
danosoft
Specialist
Specialist
Author

you mean i can put in my model like this?:

LOAD

    ANNO,

     "SOURCING",

     if(sourcing>2017,sourcing,0) as sourcing_copy

SQL SELECT *

FROM "XXX"."V_XXX_16_17";

pradosh_thakur
Master II
Master II

LOAD

    ANNO,

     SOURCING,

     if(SOURCING=2017,SOURCING,0) as SOURCING_COPY

SQL SELECT *

FROM "XXX"."V_XXX_16_17";

As per your condition sourcing should be 2017 or else zero.. so check that then do it. make sure you write field name properly

Learning never stops.