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: 
srujanaponnuru
Creator
Creator

code for getting old rating and new rating

Hi,

I have the data attached below:

i have to create two fields old rating and current rating in a straight table.

How to write a code using that data. Please help me out.

Regards

Srujana

1 Solution

Accepted Solutions
Kushal_Chawda

Please see the attached.

This is what you are looking for?

View solution in original post

11 Replies
sushil353
Master II
Master II

On what basis you want to define old and new rating?

srujanaponnuru
Creator
Creator
Author

on Cob date and CDS value

prashantbaste
Partner - Creator II
Partner - Creator II

Hi Srujana

You can use Left Join to get new ratings [Based on COBDate + Ratings + Country] by keeping attached Excel sheet on right side & main table on left. (Excel can be used as Master to map with Original Data)

Hope this will be helpful for you to resolve your issue.

--

Regards,

Prashant P Baste

prashantbaste
Partner - Creator II
Partner - Creator II

As per data it seems you need to consider COB_DATE & Country will give you a Rating value & it has to replace with new rating. Please correct me if I am wrong...

srujanaponnuru
Creator
Creator
Author

yes, u r correct.

srujanaponnuru
Creator
Creator
Author

Hi Prashant Baste           

i didn't know how to use left join to get the new ratings. could you please explain me clearly.

Regards

Srujana

prashantbaste
Partner - Creator II
Partner - Creator II

You can try like -

MainData:

Load Fieldname1,

     Fieldname2,

     COB_DATE,

     RATING,

     COUNTRY,

     FieldnameN

FROM yourtransactiontablename;

Left Join (MainData)

LOAD COB_DATE,

     RATING,

     [Rating Value] as NewRatingValue,

     COUNTRY

FROM

Downloads\Book1.xlsx (ooxml, embedded labels, table is Sheet1);

Just make sure that FieldNames on the basis of which join is going to happen should be same in main table & in excel-sheet. If not same you can alias them with same name (Ex. Load countryname as COUNTRY from Maintable)

Hope this will be helpful for you.

--

Regards,

Prashant P Baste

Kushal_Chawda

Please see the attached.

This is what you are looking for?

srujanaponnuru
Creator
Creator
Author

Thank you so much kush. Really it helped me a lot.

Regards

Srujana