Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
LINKEDIN LIVE: Democratizing data to enhance customer-centricity. JULY 29TH REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
SailajaPulugurtha
Contributor II
Contributor II

Derive format of a date field based on country column

I have two columns in my QVD, country and date. I am persisting my data into a straight table, now I want to have the format of the date to be dependent on the country value of that row. How is this best achieved?

Using the if clause to derive the value in edit script

using calculated dimension to derive the format of the date

using an expression

P.S.: There are around 10 date columns present which are supposed to be formatted

4 Replies
Taoufiq_Zarra
Master II
Master II

@SailajaPulugurtha  can you share a sample data and the expected output ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
SailajaPulugurtha
Contributor II
Contributor II
Author

Hi, attaching the sample data

I am receiving data as YYYY-MM-DD from the source system. Now in the front end I have to display that in different formats in a straight table based on the country value.

Attaching sample data with the result I am getting now and the expected one.

I have taken a calculated dimension as 

the output of this is behaving wierdly.

=if(COUNTRY='US',Date(DraftDate1,'MM/DD/YYYY'),Date(DraftDate1,'DD/MM/YYYY'))

Taoufiq_Zarra
Master II
Master II

@SailajaPulugurtha  =if(COUNTRY='US',Date(DraftDate1,'MM/DD/YYYY'),Date(DraftDate1,'DD/MM/YYYY')) works too, or you can use Pick if there is a lot of format :

=PICK(MATCH(COUNTRY,'UK','US','AU','DE','ES','FR','IE'),
Date(DraftDate1,'MM/DD/YYYY'),Date(DraftDate1,'D/M/YY'),Date(DraftDate1,'DD/MM/YYYY'),Date(DraftDate1,'MM/DD/YYYY'),Date(DraftDate1,'MM/DD/YY'),Date(DraftDate1,'DD/MM/YYYY'),Date(DraftDate1,'DD/MM/YY'))

 

or in the Script you can use Mapping load to change format based on country

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Taoufiq_Zarra
Master II
Master II

Taoufiq_Zarra_0-1604309162042.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉