Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Lokesh_5045
Creator
Creator

Grouping values in a field

I have data like below:

ID Month Value Category Difference
A January 10 - -
A February 15 Increase 5
A March 20 Increase 10
A April 25 Increase 15
B January 40 - -
B February 32 Decrease - 8
B March 24 Decrease -16 
B April 16 Decrease -24 
C January - - -
C February - - -
C March 7 New 7
C April 14 New 14


Here I am comparing values in Field 1.
Explanation: I need to compare value of each ID with January data and categorize into groups.
Like, For A, February value is more than January Value ---> Increase category
For B, February value is less than January Value ---> Decrease category
For C, it is not in January, so it is new category ----> New

Along with this category field, I need to display the difference between each month and January month.
Can anyone help me with logic/script?

Labels (4)
1 Solution

Accepted Solutions
Or
MVP
MVP

This should be easiest to achieve with a mapping load, I believe. Code might not be 100% accurate but you should be able to get it working, I'm sure.

Map:

Mapping Load ID, Value

From YourTable

Where Month = 'January';

Load *, Value - ApplyMap('Map',ID) as Difference, if(isnull(ApplyMap('Map',ID)),'New',if(ApplyMap('Map',ID)>Value,'Decrease','Increase'))

View solution in original post

2 Replies
Or
MVP
MVP

This should be easiest to achieve with a mapping load, I believe. Code might not be 100% accurate but you should be able to get it working, I'm sure.

Map:

Mapping Load ID, Value

From YourTable

Where Month = 'January';

Load *, Value - ApplyMap('Map',ID) as Difference, if(isnull(ApplyMap('Map',ID)),'New',if(ApplyMap('Map',ID)>Value,'Decrease','Increase'))

Lokesh_5045
Creator
Creator
Author

Sorry for late reply. I followed the above method and its working fine. Thank you so much