BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
tijanagilic
Obsidian | Level 7

Hello,

 

I need help on how to subtract one column from another in SAS VA.

Screenshot 2023-12-15 143138.png

I need another column next to the TEKUCI one that will be the difference = PRETHODNI - TEKUCI.

 

Or in this case below, another row, under TEKUCI, whic will be equal PRETHODNI - TEKUCIimage.png

 

Is this even possible? I didn't find anywhere any solution.

1 ACCEPTED SOLUTION

Accepted Solutions
MarkusWeick
Barite | Level 11

Hi @tijanagilic,

as this is an important feature I link the documentation of calculated items, with which you could define a Difference column.

SAS Help Center: Working with Calculated Items in a Report

Best

Markus

Please keep the community friendly.
Like posts you agree with or like. Mark helpful answers as “accepted solutions”. Generally have a look at https://communities.sas.com/t5/Getting-Started/tkb-p/community_articles

View solution in original post

4 REPLIES 4
MarkusWeick
Barite | Level 11

Hi @tijanagilic,

as this is an important feature I link the documentation of calculated items, with which you could define a Difference column.

SAS Help Center: Working with Calculated Items in a Report

Best

Markus

Please keep the community friendly.
Like posts you agree with or like. Mark helpful answers as “accepted solutions”. Generally have a look at https://communities.sas.com/t5/Getting-Started/tkb-p/community_articles
HunterT_SAS
SAS Employee

I think there's going to be a problem though in how @tijanagilic wants to display this. Getting the calculated value isn't going to be too difficult, but displaying it as another row/column after TEKUCI I don't think is possible. You can only create it as a new measure, which means it will show up as a column next to # (and thus appear twice in the crosstab, once for PRETHODNI and once for TEKUCI) rather than next to TEKUCI as a single column. 


I don't know what the column is called that contains both PRETHODNI and TEKUCI so I'm just going to call it Column but what I might recommend doing to get the visual you want is the following:

1. Create two new calculated items to represent the value of # for both PRETHODNI and TEKUCI:

If Column IN (PRETHODNI)

RETURN #

ELSE 0

and

If Column IN (TEKUCI)

RETURN #

ELSE 0

 

Now you have two new measures, we'll say Prethodni # and Tekuci #.

 

2. Create a third calculated item for the difference:

Prethodni # - Tekuci #

3. In your crosstab, take out Column and #, and instead use the three new measures we created. 

 

If I've misunderstood something though let me know.

MarkusWeick
Barite | Level 11

Maybe I missed that the two columns are in a crosstab and not original data columns.

Please keep the community friendly.
Like posts you agree with or like. Mark helpful answers as “accepted solutions”. Generally have a look at https://communities.sas.com/t5/Getting-Started/tkb-p/community_articles
tijanagilic
Obsidian | Level 7

It worked! 

 

Thank you! 😊

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 4 replies
  • 3528 views
  • 3 likes
  • 3 in conversation