Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reduce calculated dimension

Hi All

How to reduce calculated dimension, i want to put in variable, my calculated dimension is =If(Time((PlanMonth))>=today() AND (PlanMonth)<=(today()+ 30), Date(Floor(PlanMonth)))

Thanks in advance

9 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Your requirement is not clear. How do you want to "reduce" the dimension, and what exactly do you want to "put in variable"?

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

what do you mean by reducing ?

are you trying to simplify it ?

Not applicable
Author

hi jonathan and ramon, i want to put that into variable form. user asking to remove calculated dimension as much as possible.

hic
Former Employee
Former Employee

Then you should define it in the script and store the result in a field.

   If(PlanMonth >= today() AND PlanMonth<=today() + 30, Date(Floor(PlanMonth))) as PlanMonth2,

HIC

johanlindell
Partner - Creator II
Partner - Creator II

Put the formula into you load script. In the script loading the PlanMonth column add a new calculated field

Table:

LOAD *,

     If(Time((PlanMonth))>=today() AND (PlanMonth)<=(today()+ 30), Date(Floor(PlanMonth))) as [New field]

FROM MyFile.qvd (qvd);

richard
Partner - Creator
Partner - Creator

Hi Rohithhrs,

You should create a measure to use only the measure name in whatever object you like. Here is how to do it:

Create ( and use ) a variable in Qlik Sense. | Qlik Sense Tales

ramoncova06
Specialist III
Specialist III

I believe HIC already gave you the answer, since your requirement is to remove calculated dimensions (which I assume is due to performance issues) it would be better to create a new field for it, instead of creating a variable which will still be calculated at the presentation layer

Not applicable
Author

Thanks to all, hi have put like this

Step 1- adding this to the variable list

vplanmonth-  If(Time((PlanMonth))>=today() AND (PlanMonth)<=(today()+ 30), Date(Floor(PlanMonth)))


step 2- i replaced in calculated dimension  as   =$(vplanmonth)

but its not showing exact values.

jonathandienst
Partner - Champion III
Partner - Champion III

Several people have already told you to take the expression to your load script to create a calculated field.

Replacing the calculated dimension with a variable will perform exactly the same way as the calculated dimension, except that its harder to maintain (and debug, as you have seen).

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