I'm trying to put together a bar chart and a multiple line plot grouped by a column chart into a single bar-line chat in SAS Enterprise Guide.
If I select a bar-line chart, the only option is to assign columns to -
bar sum of and (bar chart)
line sum of task roles. (line chart)
However, I do not need any aggregations and I only have to print the graph for the data set as is.
Please let me know the best way to generate a bar line chart in SAS Enterprise Guide.
Thanks in advance!
Depending on what your dataset looks like, the sum might well be the answer. If your dataset only has one row per bar or line you're looking for, then asking for the sum will get you the sum of one item - i.e., its value.
For example, let's say you take the built-in dataset sashelp.class. You want a bar-line chart with the heights and weights of the students as the bars and lines, respectively.
You select "Column to chart" -> "Name", then drag Height over to "Bar sum of", and drag Weight over to "Line sum of". Then you get a nice bar/line graph showing heights and weights - technically sums, but sum of one number is itself.
If your dataset doesn't have a variable appropriate for Column to chart (i.e., an identifier variable that would represent a single row in the data), you may need to modify your data to conform to this; otherwise SAS doesn't have a good way to tell what is supposed to be in one bar.
Related
I'm pretty new to Power BI.
I've been adding columns to different charts, graphs and tables and everytime, the axis names/column names have a "Sum of" infront of them even though the values being used in the graph are not discrete values.
How do I fix this to show only the column names as axis names?
PS, I'm following these videos to learn: https://www.youtube.com/watch?v=3NV5Jtbhfcw&list=PLUaB-1hjhk8HqnmK0gQhfmIdCbxwoAoys&index=8&ab_channel=AlexTheAnalyst
I tried to check if any columns have a "don't summarize" type option when I right click them but they're not present.
You can edit the label. Select your chart, go to X/Y-axis double click. Type what you want.
I got a bar chart and I need to re-order the bars show in it. The bars show at which speed a person was driving and are currently sorted by the one that appears most often.
The data is imported in the structure:
The fields named *_id are used for filtering. What is shown in the bars is the count of the gemeten_snelheid column.
As shown in the bar chart the speeds are not sorted by "speed" but by count. Is it possible to re-order the bars so they are arranged by speed, and how would this be done?
I don't really know how to create a working example of this as the data is imported from a database connection, so if any more information is required feel free to ask.
You could create a new column and order by it, you could do it in sql, for example:
case when column1<30 then 1
when column1<40 then 2
when column1<50 then 3
column1_sort
Or you can do it in PowerBI, you could Add Column -> Conditional Column and write your Ifs. Or you can when in PowerBI desktop right click table, select New column and write something like:
Column_sort = if([Column1]="<30",1,if([Column1]="<40",2,if([Column1]="<50",3,4)))
Then select your not sorted column (Column1) and under Column tools there is Sort by column, and from there select column1_sort
Did you tried this below option? Here I am getting your expected output-
Is there way to display monthly intervals in a bar chart and the remainder as a single bar in a chart. For example May20 Jun20 Jul20 Aug20 Sep20 Oct20 [The remaining data]
Thanks
You are trying to create a report with two different grains (Month-Year) and a group of Month-Years.
In order to achieve your desired result, you will need to do four things:
Create a summary table that summarises and groups by Month-Year for your range
Create a summary table of the "All The rest"
Union the two summaries (you could collapse in to one query at this point). You will need two columns, your Period (either le May20 Jun20 Jul20 Aug20 Sep20 Oct20 or ALL) and the value.
Create a sort column to make sure things order correctly
This gets everything in the right grain. However, when you plot it all on one chart, the "all" bucket may distort your results with one large bar and each Month-Year being a fraction thereof.
I'm trying to create a bar chart with the count of nonblank rows as values and the column headers on the axis.
I've created some 'hard-coded' measures that look at each of the columns, e.g.:
COUNTBLANK(Planning[Actual_ClosingMeeting])
but when charting they are clustered together under a single axis value.
I was thinking if I could create a measure that looked at nonblank rows I could chart that and the axis would work as a filter? Perhaps this approach isn't the solution though.
Thanks
Here's one possible way to do this (there are probably better ones if you've got many columns you want to chart rather than a handful):
Create a new table (Home > Enter Data) that has a single column containing all the different headers that you want on your column chart. E.g.
MeetingType
-----------
Closing
Draft
End
Once you have that defined, create a new calculated column (Modeling > New Colum) which counts the blanks corresponding to the different columns using a SWITCH function.
Count = SWITCH(MeetingType[MeetingType],
"Closing", COUNTBLANK(Planning[ActualClosingMeeting]),
"Draft", COUNTBLANK(Planning[ActualDraftMeeting]),
"End", COUNTBLANK(Planning[ActualEndMeeting]))
Now you can create a bar chart with MeetingType[MeetingType] on the axis and MeetingType[Count] in the values box.
MWE set up:
1) From the Power Bi visual website: https://app.powerbi.com/visuals/ there is a custom download "Box and Whisker (Jan Pieter)"
2) Download sample.
3) create new measure with dax formula:
Distinct count score = if(distinctCOUNT(Courses[Score]) > 4, average(Courses[Score]), Blank())
4) Add a Stacked column chart with Course as the axis and the newly created 'Distinct count score' as the Value and get the following:
5) compare this graph to the Box and Whisker provided by Power BI:
Here is my problem. I only want to show values in the Box and Whisker where the Distinct Count of Scores is greater than 4 -- So I only want Physics to show up (like the stacked column chart above).
So if I try the solution working with the stacked bar chart using the Dax formula. I get the following--nothing shows up:
And this is what I want to happen:
Question:
Is there a way in Power BI run and distinct count statement within a Box and Whisker chart to only show data with > 4 distinct values (or any if statement)?
I want it to be formula based, I cannot just 'visual filter' items I do not want.
Possible answer:
I thought about going to the source code to try and 'throw in' a if statement. But I went to the developers git hub: https://github.com/liprec -- I couldn't find the repo for this visual.
Basically this is due to the way the box and whisker chart is working. The visuals needs a dataset to calculate the values (mean, median, etc.) and use those values to show the box and whisker.
So in your case you need to create a measure that is on the same level as the scores (because those values are needed) and is only available. See the screenshot for a visual explanation of the needed measure.
I created the measure with the follow DAX measure:
Filter Score = IF(CALCULATE(DISTINCTCOUNT(Courses[Score]), ALLEXCEPT(Courses, Courses[Course]))>4, MIN(Courses[Score]), BLANK())
The Boolean expression of the IF statement calculates the distinct scores per course via a CALCULATE expression and the ALLEXCEPT filter option to ignore everything but the course value. And the TRUE part returns the score which needs to be aggregated, so the MIN and the FALSE part return a BLANK() value so is can be ignored.
When you add the new measure and create a BW chart it will only show 'Physics' course results.
If you need more help, please let me know here or via email.
-JP
BTW: I just updated my PowerBI visual GitHub repository (https://github.com/liprec/PowerBI-custom-visuals) and added my box and whisker chart and my hierarchy slicer to it in the folder oldAPI.
The crux of your problem, as far as I can tell, is that you want to filter visuals to courses that have a particular number of distinct values. Which visual you want to use is almost irrelevant (though it was helpful to have a sample Power BI workbook to follow along with).
The way I'd approach this (and not saying this is the best or only way)
Step 1
Create a new Course dimension table, with one row for each unique course. In the sample workbook, you can click 'Enter Data' and manually type in the data.
Course
------
English
Math
Physics
Step 2
Next, create a calculated column in the new table and calculate the distinct count for each course. This isn't a measure - it's a column in your table, that uses the Distinct Count calculation from your question.
Distinct Count = CALCULATE(DISTINCTCOUNT(Courses[Score]), SUMMARIZE('Courses','Courses'[Course]))
The SUMMARIZE works like a GROUP BY. In essence, creating one row per course with a distinct count of scores.
Step 3
Use this new attribute as a filter on your visual. You can then dynamically alter the number of distinct values as you feel like (4, 3, 2).
I know this isn't quite as good as typing a formula into the visual filter field, though in practice it's still formula driven. The formula is just on an underlying table.
Why so complex?
The reason you have to do this for the Box & Whiskers visual, whereas your 'Distinct Count score' measure works so well, is that on the column chart, you are displaying a single value (the average score). The Box & Whiskers chart, by contrast, is plotting every individual score.
In fact, if you removed the 'Course' from the axis of your column chart, the value changes as it adds back in the courses you filtered out. (The reason for this is that, if no course is on your axis, your formula calculates the distinct count of all the courses, which is 7). Likewise, if you were to filter your column chart to a particular session, your column chart would go blank (since in any given session, no course has more than 4 distinct values).
The technique I've described above fixes those problems, because it filters out the courses Math & English from the get-go. It doesn't matter if you've filtered to a single session, or not filtered by course at all. English & Math will always be excluded as long as their distinct count is below the value you specify.
Hope this helps.