

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Help me to derive new field based on my two fields?
Hi All,
Can you please help me to compare two fields and derive new field (New Severity). Please find my sample data and expected output column.
Initial Severity | Latest Severity | New Severity (Expected Output) |
High | Low | N/A |
Low | Med | Med |
Med | High | High |
High | Low | N/A |
Med | High | High |
Low | High | High |
Med | Low | N/A |
High | Med | N/A |
Low | Med | Med |
- « Previous Replies
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be this
Table:
LOAD RowNo() as RowNum,
[Initial Severity],
[Latest Severity],
If([Latest Severity Rank] > [Initial Severity Rank], [Latest Severity], 'N/A') as [New Severity];
LOAD *,
Match([Initial Severity], 'Low', 'Med', 'High') as [Initial Severity Rank],
Match([Latest Severity], 'Low', 'Med', 'High') as [Latest Severity Rank];
LOAD * INLINE [
Initial Severity, Latest Severity
High, Low
Low, Med
Med, High
High, Low
Med, High
Low, High
Med, Low
High, Med
Low, Med
];

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be this
Table:
LOAD RowNo() as RowNum,
[Initial Severity],
[Latest Severity],
If([Latest Severity Rank] > [Initial Severity Rank], [Latest Severity], 'N/A') as [New Severity];
LOAD *,
Match([Initial Severity], 'Low', 'Med', 'High') as [Initial Severity Rank],
Match([Latest Severity], 'Low', 'Med', 'High') as [Latest Severity Rank];
LOAD * INLINE [
Initial Severity, Latest Severity
High, Low
Low, Med
Med, High
High, Low
Med, High
Low, High
Med, Low
High, Med
Low, Med
];

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try a formula like this in the script:
Severity_Table:
Load
Initial_Severity,
Latest_Severity,
IF(Latest_Severity='High', 'High',
IF(Latest_Severity='Med' and Initial_Severity<>'Low','Med',
IF(Latest_Severity='Low' and Initial_Severity='Low','Low',
'N/A'))) as New_Severity
From YourData.QVD;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reply Sunny. It is working. Can you please explain in some words, how it is working...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assigning numeric values to High (3), Med(2), Low(1) and then doing a comparison like this
If(Latest > Initial... then use Latest otherwise use N/A


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Sunny.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunny, One query here.
Do we need to use RowNo() compulsory. Is there any other optimized way.
Please advice.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
RowNo() is not needed ... it was just to show all the rows on the front end of the application... but you can remove that


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need all rows what ever i provided in sample. so we need to use RowNo() right?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
All the rows will be there... just won't show up on the table box without a unique identifier in the table box. For example, the two rows circled are the same exact... they will be in your dashboard, but in a table box with these three fields... they will only show up once. If you do a count with these three fields as dimension... you will see that the count is 2
Does that make sense

- « Previous Replies
- Next Replies »