BookmarkSubscribeRSS Feed
Ramakanthkrovi
Obsidian | Level 7

This is a query on the basis of the following thread

 

https://communities.sas.com/t5/SAS-Visual-Analytics/Create-a-custom-category-in-SAS-VA-using-2-diffe...

 

I have a different issue compared to the one above. I need to create a custom category/ calculated item which is unique.

 

I have attached the screenshot to understand it better - In the bar chart, "Group" is a sum of all revenue across all regions (including APAC, Europe and Americas), APAC is just APAC and "Rest of the world" is Europe and Americas. They are all built off the same variable. I need to create a category/ calculated item to use in a bar chart and assign values accordingly.

 

 

screenshot.png

 

Of course the below code doesn't work but below is a sample of how I expect it to work.

 

 

IF ( 'Geo'n In ('APAC', 'Europe', 'North America', 'Enterprise') )
RETURN 'Group'
ELSE (
IF ( 'Geo'n = 'APAC' )
RETURN 'APAC'
ELSE 'Rest of the World'

 

6 REPLIES 6
SASKiwi
Opal | Level 21

Looks like you are missing a bracket at least:

IF ( 'Geo'n In ('APAC', 'Europe', 'North America', 'Enterprise') )
RETURN 'Group'
ELSE (
IF ( 'Geo'n = 'APAC' )
RETURN 'APAC'
ELSE 'Rest of the World')
Ramakanthkrovi
Obsidian | Level 7

True, but that was what I put together quickly to help you understand the problem. Smiley Wink

 

Because I am including all values of 'Geo' to create 'Group' - the new calculated item will always have only one value - Group.

 

 

SASKiwi
Opal | Level 21

Another reason this is not going to work is you have APAC both in the "GROUP" and as its own category. I suspect you will have to create two custom categories, one for GROUP, and another for APAC/Rest of World. Give it a try.

Ramakanthkrovi
Obsidian | Level 7

Exactly, that is the problem. I want to create a category which is custom and I already explained that in the initial question.

 

it is like writing 

sum(All geos) = "Group"

APAC = "APAC"

sum(all geos) - APAC = "RoW"

 

that is the custom category. is it possible in SAS VA?

SASKiwi
Opal | Level 21

You can't sum a character column. I suggest you experiment with splitting your customer category into two separate ones as already discussed.

GertNissen
Barite | Level 11

Try

IF ( Geo= 'APAC' )
RETURN 'APAC'
ELSE 'Rest of the World'

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1470 views
  • 0 likes
  • 3 in conversation