Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to combine two number fields together. I have two fields. One is Year and the other is Month.
During the load, I want to create a new field with these two fields.
Year = 2014 Month = 08
The new field will have a new value something like 2014-08
Year &”-“& Month Does not work.
are you using qlik syntax in the qlik side of the script or in the sql side?
// start of qlik side
LOAD
.....,
.....
;
// end of qlik side
// start of sql side
SQL SELECT
....
from
....
;
Try single quotes...
Year &'-'& Month as YEAR_MONTH
Thanks for the reply,
My bad, typo I did have single qoutes.
The result value is 0
that is wired... it should work. Here all you are doing is concatenating two fields with a separator.
Year &'-'& Month as YEAR_MONTH
Can you check the number format of this dimension in Document properties -- > Number tab
Mark as "Mixed" .
If that doesn't resolve post a sample QVW
Hi Tom,
Try like this
LOAD
*,
Text(Year & '-' & Month) AS YearMonth
FROM DataSource;
Now use this new field as dimension wherever you required.
Regards,
Jagan.
Try this:
Year &'-'& (num(Month, '00')) as Year_Month
or use the function:
MonthName(Date) | as xMonthYear, |
How about
=Year & '-' & Month
I tried this Text(Year & '-' & Month) AS YearMonth
well a verision of it. Text(Year) & '-'& Text(Month) as YearMonthLink
It came up with a SQL error on load.
In order to get a real date field, try this expression
Date(MakeDate(Year, Month, 1), 'YYYY-MM') as MonthName
This way you can also use this field with date functions and in calculations like any other date field.
hope this helps
regards
Marco
are you using qlik syntax in the qlik side of the script or in the sql side?
// start of qlik side
LOAD
.....,
.....
;
// end of qlik side
// start of sql side
SQL SELECT
....
from
....
;