Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jtay
Contributor III
Contributor III

Can a variable be formatted as a number?

I have a field in my Master Calendar called Month Sequence.

(,AutoNumber( year(TempDate)&month(TempDate)) as MonthSequence)

It is generated as a number field.

In a KPI, Max(MonthSequence)   show 142  which is correct.

Also in a KPI   Max(MonthSequence)-12   shows 130      I can perform calculations on that number.

I’ve defined the variable $(vMaxMonSeq) as Max(MonthSequence)    adding the variable to a KPI shows a value of  142

But, I can’t do any calculations with it.

I've tried setting it up as a number with num(), num#(), and with num(num# (Max(MonthSequence)))

I can change the variable definition to Max(MonthSequcne)-12   and it will show correctly.

Do all variables come in as text?   What are my options?


Nothing seems to work. 

Thank you

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar

But, I can’t do any calculations with it.

Can you give an example of a calculation you're trying to do. An example QS app would help.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

But, I can’t do any calculations with it.

Can you give an example of a calculation you're trying to do. An example QS app would help.


talk is cheap, supply exceeds demand
jtay
Contributor III
Contributor III
Author

I will work on getting an example...

but the calculation I'm trying is simply subtracting 12. 

$(vMaxMonSeq)-12

Anonymous
Not applicable

you could try $(#vMaxMonSeq) for getting the number...

jtay
Contributor III
Contributor III
Author

Hi Gysbert

I got an example app ready to post and was adding the KPIs with the calculation examples to a sheet. 

I created the variable.  I added two KPIs without the variable and two more with the variable.

They all worked correctly.  (scratches head and wonders why...)

I copied everything into my main app and now things are calculating correctly there too.

Problem solved, but I don't know why it wasn't working before.

I guess the exercise of starting over helped.  thanks you for the suggestion.

Gysbert_Wassenaar

You're welcome. Glad you got it sorted now.


talk is cheap, supply exceeds demand