BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Lindea
Fluorite | Level 6
Hi.

I am trying to make a stacked grouped barchart.

It have the following variables in my dataset.
- A month variable (Month - Category variable)
- A budget variable (Budget - Measure
- A realized spending (Spendings - Measure)
- A variable that tells me what departement of my company the spending is allocated to (Department - Category)

We have 5 different departements and different budgets in every month in the Company.

I want to make a barchart in SAS VA, that stacks the budgets of the different departements on top of each other for every month (so I can see the departements with Big budgets)

Just beside the total Company budget, i want the realized spendings also grouped by departement. So I can compare how the different departements do, but also so I can have an overall View of the entire Companys spendings in a month.

I have found a similar issue, but cant get it to work:
https://communities.sas.com/t5/SAS-Visual-Analytics/Stacked-and-grouped-bar-chart/td-p/170885
1 ACCEPTED SOLUTION

Accepted Solutions
MarkusWeick
Barite | Level 11

You can use the “Data Preparation” to do the data conversion.

Bruehl_0-1665088251436.png

 

In a dataquery an additional column can be added to the table and set to 1. Then the new table is saved as “Stackedgroup1”:

Bruehl_1-1665088251550.png

 

Same is then done in a second query and value 2 for the additional column in the table “Stackedgroup2”.

Then the table “Stackedgroup1” is appended by “Stackedgroup2”:

 

 

Bruehl_2-1665088251624.png

 

 

The newly appended table “StackedGroup1” then can be loaded into the Report Builder. With two new calculated Items the needed columns can be created:

 

Bruehl_3-1665088251666.png

 

 

Bruehl_4-1665088251702.png

 

Now there are the columns needed for the graph:

Bruehl_5-1665088251796.png

 

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

14 REPLIES 14
Madelyn_SAS
SAS Super FREQ

Which version of Visual Analytics are you using, and what problems are you having when trying to follow the other community post? 

Lindea
Fluorite | Level 6
I dont know What version to be fair. But it looks exactly as @MarkusWeick ‘s screenshot
MarkusWeick
Barite | Level 11

Hi @Lindea,

 

is this the kind of graph you are looking for?:

Stacked (2).png

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
Lindea
Fluorite | Level 6
Hi.

Yes - exactly.

But I don’t have an “Amount” variable.

I only have 4 different variables. In my dataset it could look like this:

Month | Dept | Realized | Budget
6 | A | 120 | 110
6 | B | 110 | 150

And so on.
Therefore I believe that I have to make a custom graph, but I cant Seem to make it work.
MarkusWeick
Barite | Level 11

Hi @Lindea 

right, I had to reorganize the data:

Stacked 3.png

Would this be a possible way for you?

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
Lindea
Fluorite | Level 6
Maybe.

Is there not any Way to do it in sas?
MarkusWeick
Barite | Level 11

In SAS there is a way. I'm not yet sure, if you can be done in VA only.

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
MarkusWeick
Barite | Level 11

It can be done in VA. I will describe it later.

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
MarkusWeick
Barite | Level 11

You can use the “Data Preparation” to do the data conversion.

Bruehl_0-1665088251436.png

 

In a dataquery an additional column can be added to the table and set to 1. Then the new table is saved as “Stackedgroup1”:

Bruehl_1-1665088251550.png

 

Same is then done in a second query and value 2 for the additional column in the table “Stackedgroup2”.

Then the table “Stackedgroup1” is appended by “Stackedgroup2”:

 

 

Bruehl_2-1665088251624.png

 

 

The newly appended table “StackedGroup1” then can be loaded into the Report Builder. With two new calculated Items the needed columns can be created:

 

Bruehl_3-1665088251666.png

 

 

Bruehl_4-1665088251702.png

 

Now there are the columns needed for the graph:

Bruehl_5-1665088251796.png

 

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
Lindea
Fluorite | Level 6
Well. I just tried to do so.

But when I choose the “Group” I can’t assign the variable
MarkusWeick
Barite | Level 11

Could you please share a screenshot of data and role details as here:

 

Stacked 5.png

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
acordes
Rhodochrosite | Level 12

@Lindea If you don't recognize someone's effort to help you out by giving likes or marking his contribution as solution you will likely end up having a monologue here...

Lindea
Fluorite | Level 6
I am Sorry. I didn’t know how to do it. I think I by mistake marked your as solution
acordes
Rhodochrosite | Level 12

It's fine, don't worry. 

It's not for me, it aims at improving the overall experience and reward those helping hands with applause. 

The SAS community is amazing and let's contribute all to keep this spirit alive. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 14 replies
  • 976 views
  • 5 likes
  • 4 in conversation