Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Exchange rate

    Hi All,

I have the following code:

 

CurrencyMonthRate
USD2017011
USD2017022
USD2017033
USD2017044
ASD2017015
ASD2017026
ASD2017037
ASD2017048

Now i need to get the rate where my month is 201703. Output should be:

USD     201703      3

ASD     201703      7

Can you please help me how can i achieve it. I need to do in script.

Thanks,

Bharat

1 Solution

Accepted Solutions
sunny_talwar

Try this

Table:

LOAD Currency,

Date#(Month, 'YYYYMM') as Month,

Rate;

LOAD * INLINE [

    Currency, Month, Rate

    USD, 201701, 1

    USD, 201702, 2

    USD, 201703, 3

    USD, 201704, 4

    ASD, 201701, 5

    ASD, 201702, 6

    ASD, 201703, 7

    ASD, 201704, 8

];


Right Join (Table)

LOAD AddMonths(Max(Month), -1) as Month

Resident Table;

View solution in original post

6 Replies
tresesco
MVP
MVP

Have you tried like:

Load

          *

From <> where Month=201703;

sunny_talwar

What is the logic behind picking 201703? Will this never change or are you always looking to pull in Max period minus one month?

bharatkishore
Creator III
Creator III
Author

Sunny bhai,

I need to pull max of period minus one month as of now, but later it will be same month i.e. for ex 201805.

bharatkishore
Creator III
Creator III
Author

Thanks Tresesco, i thought too much but forget where condition.. thank you..

sunny_talwar

Try this

Table:

LOAD Currency,

Date#(Month, 'YYYYMM') as Month,

Rate;

LOAD * INLINE [

    Currency, Month, Rate

    USD, 201701, 1

    USD, 201702, 2

    USD, 201703, 3

    USD, 201704, 4

    ASD, 201701, 5

    ASD, 201702, 6

    ASD, 201703, 7

    ASD, 201704, 8

];


Right Join (Table)

LOAD AddMonths(Max(Month), -1) as Month

Resident Table;

bharatkishore
Creator III
Creator III
Author

Thank you Sunny Bhai...Thanks a lot...