Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

variable problem

Hi,

how can i add a variable like "month(today())" to month in below set analysis. thanks

Sum({<year={2013},month={May},day={2}>}TRA_QTY)

30 Replies
its_anandrjs

It seems your Month field has not proper data related to the month like there is spaces but the expression =Month(AddMonths(Today(),-1)) gives you May in the result. Before going further you need to decide what are the fields available in the data model according to that you have to use SET expression

Try Once

Sum({<year={2013},month={ '$ (=TRIM(Month(AddMonths(Today(),-1 ))))' }, day={2}>}TRA_QTY)


Because by hard coding you get right result and before posting the question try with post with sample data that will help a lot


But all the expression suggest by members meet your expectation check from your end or provide few lines of sample data.


Regards

Anand

Not applicable
Author

hi tresesco,

yes. it s returning values correctly

Not applicable
Author

HI all,

this is some what large application and i m unable to provide a sample because the data are privet and confidential. pls if  anyone can upload a simple application regarding this then i can understand. thanks

Not applicable
Author

hi, my months are returning like Jan, Feb....

tresesco
MVP
MVP

It seems that your month field is not properly created in the script. Create it in the script using month() like:

Load

          Month(DateFiel) as month

Then it should work fine.

Not applicable
Author

Month(AddMonths(Today(),-1 )))

for this I m getting "May"

Not applicable
Author

month(TRA_DATE) as month

i m creating month field like this. because i only have date field in my DB

tresesco
MVP
MVP

Now, it's becoming tougher without seeing your app. See here: Preparing examples for Upload - Reduction and D... | Qlik Community

its_anandrjs

You can create different field like

Load

Month(TRA_DATE) as Month

Num(Month(TRA_DATE)) as NumMonth


From Location;


And use NumMonth field in SET analysis expression.


Not applicable
Author

Hi Manish,

this is having a error