power bi taking count of number - powerbi

iam taking simple clustered bar chart and want to take top 10 rows of computers that goes out of warranty
so ideally my chart should look like this
but instead my bar chart is looking like
i dont want count of count of count
can you please help me out how to add exact number in bar chart or am i taking wrong visual?

I believe you need to change your X via rightclick on the "Values"-Slot to something more like "Minimum", "SUM" or "Average". PowerBI doesn't seem to know you have one value only and attempts to group them. Hence it informs you that the "count of values(count)" is always one.

Related

How to get multiple category lines with bar chart in Power Bi?

Sample Data.
CompanyA,2019-01-01,29000
CompanyA,2019-02-01,35000
CompanyA,2019-03-01,43000
CompanyA,2019-04-01,27000
CompanyA,2019-05-01,45000
CompanyA,2019-06-01,21000
CompanyA,2019-07-01,26000
CompanyA,2019-08-01,27285
CompanyA,2019-09-01,26035
CompanyA,2019-10-01,24785
Expected Output.
My Boss has asked me to show sale trend by companies and month. but he wants it to be shown like below.
X axis should have Month Names
Bar lines should tell overall sales amount by month.
multiple lines should represent company sales amount.
i have achived this output by replacing 2 charts on each other (hidden one background). 
First i have taken a CLUSTERED COLUMN CHART and place a Line chart on it with hidden background.
Sample File
But for me this is just an adhoc solution and One more problem is that both chart's y axis doesn't match.
seeking for a good solution on this. either another good chart to represent this kind of data or how to achive it any other way?
Thanks in advance.
You can create measures for individual company, if number of companies is not a big number, and then put them in "Line values" to achieve the same result as above.
So For ex, if you have 5 companies in the data then create 5 different measures like below
CompanyA = calculate(sum(sales), filter(tbl, [company] = "CompanyA"))
like the above ex create measures for other 4 companies also

Power BI: Bar chart with percentage

I need to get a bar chart that displays percentages based on the simple division of 2 values. See below:
The calculation should be 'Services / Sum of Accounts' to get my %. (116,713 / 121,756 = 0.9585 [or 95.9%])
I have tried using Quick Measure, but I can't seem to get it to do what I want. I come from a background of SSRS, but the way PBI works appears to be different enough that I'm not sure how to accomplish this otherwise simple operation. Much thanks!
You probably need to write your own measure. You can start with a quick measure and modify the formula or create one from scratch.
I don't know what your data looks like but it might be something like
SUM(Table[Services]) / SUM(Table[Accounts]).

How to group measures to display on a Power Bi Clustered chart?

I have several measures computed and I am placing them on the Line and Clustered column chart to display them side by side. The challenge I am having right now is i can not group them for displaying on the Chart. Please see the attached screenshot.
As you see all the measures are appearing one next to the other, total of 10. I want to separate them and show them as a group of two. Is this possible to do, may be by using other type of chart? I have to use the measures coz they contain computed values from the dataset imported.
If any one has an idea over this, please help. Thanks in advance.
Create a new table with one column containing all of the groups that you want. For example: Gross, Net, and Total and put that Group column on the clustered bar chart axis.
Create a measure for the first bar of each group and a measure for the second bar each group. For example:
Actual = SWITCH(SELECTEDVALUE(Groups[Group]),
"Net", [NetActual],
"Gross", [GrossActual],
"Total", [TotalActual])
Budget = SWITCH(SELECTEDVALUE(Groups[Group]),
"Net", [NetBudget],
"Gross", [GrossBudget],
"Total", [TotalBudget])
Now put the Actual and Budget measure on in the bar chart Value field and you should get something like this:

Power bi box and whisker: filter with an if statement

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.

Bar-Line chart in SAS Enterprise Guide

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.