Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
300sss300
Creator
Creator

How to Combine 2 fields as Dimensions?

I have 02 fields Year and Quarter

                         2016     Q1

                         2016     Q2

                         2016     Q3

                         2016     Q4

                         2015     Q1

                         2015     Q2

                         .          .

                         .          .

                         .          .

I want to use "YearQuarter" as Dimension like 2015 Q1  2016 Q1

How I can combine both Year and Quarter so that it should become 01 field to be used as Dimension.

Regards,

stalwar1

1 Solution

Accepted Solutions
sunny_talwar

I suggest combining them in the script just like Onno‌ mentioned, but I would suggest using a Dual function so that you can sort them in your dimension without using any sort expression

LOAD Year,

           Quarter,

           Dual(Year & ' ' & Quarter, Num#(Year & Num(Right(Quarter, 1), '00'))) as YearQuarter

FROM Source;

View solution in original post

8 Replies
oknotsen
Master III
Master III

Glue them together in your loadscript:

Year & Quarter as YearQuarter,

May you live in interesting times!
sunny_talwar

I suggest combining them in the script just like Onno‌ mentioned, but I would suggest using a Dual function so that you can sort them in your dimension without using any sort expression

LOAD Year,

           Quarter,

           Dual(Year & ' ' & Quarter, Num#(Year & Num(Right(Quarter, 1), '00'))) as YearQuarter

FROM Source;

SunilChauhan
Champion
Champion

Year &' '&Quarter as New field .


but i will suggest go with Sunny T solution above. as it will allow you to sort as numbers.

Sunil Chauhan
tresesco
MVP
MVP

Ideally one should try with proper date function like QuarterName() which gives output in a bit different form like:

QuarterName ( '2005-10-29' ) returns 'Oct-Dec 2005'


However, if your format matters, you could use Dual() to give it a flexibility of sorting in the front-end without much manual effort. Hence, try like:

Dual( Year&'-'&Quarter, QuarterName(Date)) as YearQuarter

300sss300
Creator
Creator
Author

Thanks !!!

300sss300
Creator
Creator
Author

Thanks !!!

300sss300
Creator
Creator
Author

Thanks !!!

300sss300
Creator
Creator
Author

Thanks !!!