Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for
Search instead for
Did you mean:
Creator III

## Exchange rate

Hi All,

I have the following code:

 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

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
MVP

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;

6 Replies
MVP

Have you tried like:

Load

*

From <> where Month=201703;

MVP

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

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.

Creator III
Author

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

MVP

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;

Creator III
Author

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

Community Browser