Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
NEW webinar Dec. 7th: 2023 Outlook, A Pivotal Year for Data Integration SIGN ME UP!
cancel
Showing results for 
Search instead for 
Did you mean: 
s4ni9r
Contributor III
Contributor III

Splitting Year from YearWeek

Dear All,

I have YearWeek, which shows values as shown below, i want to separate this into two different columns.

1. Year  2. Month, Could you please help me , how to get Year seperatly and Month Speratley

 

WeekYear
2021-01
2021-02
 
2021-52
2021-53
Labels (1)
1 Solution

Accepted Solutions
s4ni9r
Contributor III
Contributor III
Author

6 Replies
NitinK7
Specialist
Specialist

try below

Subfield(YearWeek,'-',1) as Year

Subfield(YearWeek,'-',2) as Month

s4ni9r
Contributor III
Contributor III
Author

the second value after '-' is actually week, but i want in Year as seperate field and Month as seperte field using YearWeek as source field

PrashantSangle

Hello,

use makeweekdate() to convert you week into date and then from date you can easily get month & year

try like

Month(makeweekdate(left(WeekYear,4),right(weekYear,2))) as Month,

left(WeekYear,4) as Year,

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
s4ni9r
Contributor III
Contributor III
Author

ThankYou Very Much  Sir

PrashantSangle

if it work for you then like that solution and select accept as solution.

Great dreamer's dreams never fulfilled, they are always transcended.
s4ni9r
Contributor III
Contributor III
Author

Sure  Sir