Power BI - Detect Outliers and the best way to show it - powerbi

I have my data like this,
Country Value
USA 100
USA 120
USA 200
UK 200
UK 210
UK 400
I need to detect outliers for each country and show them in a visual.
I tried using the box plots (Country Vs Value), but I have nearly around 3M rows and it crashes. Any suggestions on how to solve this issue in a better way would be appreciated.

Power BI has anomaly detection since the November 2020 update.
If it's choking on the size of the data, then it might help to define an aggregated table where you group it at the level needed for the visual so that, e.g., you only have as many rows as countries for your example.

In case your data per country has a normal distribution. It may help to filter on the rows where the value column Z-score is higher than 3 times the Average of the data for country(i).
The Z-score measures how many standard deviations the data point is away from its mean (X̄). Then once identified the outliers for each country, you may draw a scatter plot, showing data points in the same plot, with a different color by country.

Related

Problems calculating percentage of subtotals in PowerBI

I'm having problems with a line chart calculating the percentage of subtotals. What I have at the moment is as follows:
The PowerBI Data is structured similarly with a few extra columns.
I want to do a line graph where for each quarter, I have the percentage of each result for that quarter. For example, In Q4, between Business Unit A and B, I have 45 Passes, 2 Partial Passes, and 19 Fails. so of a total of 66, Q1 should show 68% pass, 3% partial pass, and 29% Fail. When I do the chart in Excel, I get the following (which is what I want to replicate in PowerBI):
In order to build this in PowerBI, I'm using a measure with the following formula:
Percentage = DIVIDE(SUM('TABLE NAME'[Number]),CALCULATE(SUM('TABLE
NAME'[NUMBER]),ALLEXCEPT('TABLE NAME'[DATE].[QUARTER])
When I use that formula, if I filter on an individual quarter, the chart values are correct, but when more than 1 quarter is displayed, the percentages are incorrect:
1 Quarter displayed:
Full Chart Displayed
The percentages between the chart in Excel and PowerBI are off when multiple quarters are displayed in PowerBI. I can't for the life of me figure out how to get the chart to be correct.
Any help would be tremendously appreciated.
Thanks!

PowerBI Total Cost/Unit sums monthly calculations rather than creating a total for selected months

In my dashboard I'm adding a cost/unit metric. The problem is, if I select more than one month, it just adds the monthly calculations. For example,
Store
Month
Units
Cost
Cost/Unit
Blue
Jan
10
20
2
Blue
Feb
20
60
3
Red
Jan
10
30
3
Red
Feb
20
80
4
When I create a table with with these, and select January and February in the Splicer it shows something like this:
Store
Cost/Unit
Blue
5
Red
7
Of course this isn't the real total cost/unit for both months. Instead I'd like for it to show:
Store
Cost/Unit
Blue
2.67
Red
3.67
I am pretty new to PowerBI so I'm sorry for the lack of words on how to explain this, but help would be very much appreciated!
Going by the result, it seems that you might have created your metric as a calculated column rather than a measure. This would mean that the expression is evaluated and stored for each row and it would sum up for aggregated values (like any existing column).
If you create the same metric as a measure:
UnitCost = Divide (SUM('TableName'[Cost]), SUM('TableName'[Units]))
Power BI would calculate it based on the context and you would always have the correct value.

Hi, Is there a way to build a power BI bar chart using multiple heirarchies and avoid calculating averages of averages when drilling up?

I have a dataset with columns Country, State, City, Sales. I wanted to build a drill down bar chart to drill from country to State and then City, showing the average sales. My problem is that I can't find a workaround to avoid power bi calculating the average as the average of the inmediate lower heirarchy. Since I have States with much more cities than others, when I get to category Countries, the averages are wrong, because Two States with different amount of cities are weigthed the same way when summarizing to the upper level.
Is there any way to define the granularity level on which averages should be calculated or any other workaround.
Example
example dataset
For country A, I want to show the average as 16.
Currently is doing the average between States X and Y, whose averages are 17.2 and 13, giving 15.1 as a result.
Any help on how to solve this problem will be preciated. Thanks.
avgMeasure:= CALCULATE(AVERAGE(tbl[sales]),ALLEXCEPT(tbl,tbl[country]))

How to manage custom number formatting in power BI?

How can I do custom number formatting in a Power Bi visual?
I don't want to show all value as million. I want to put thousand for 1-day value, and million for 1-week value and year for 1-year value.
Power BI charts follow the principles of good data visualisation. That includes a scale that is relevant to the data with labels that relate to the scale.
In the visualisation, the differences for the values less than 1M are not discernible. The label with the 0M supports that approach, although it doesn't look great. But that happens when you have a chart with very large AND very small values. Power BI only supports one display unit and you selected Millions.
You may want to consider using a different visual for the data. Not all visuals to be shown as charts. If you want to show the exact numbers, then a simple table might be a better approach. In a sorted list of numbers, the digits in a number act very much like a horizontal bar.
Or split the chart in two and show one chart for values above 1M and another for values below 1M.
Or use Thousands as display units instead of Millions.

Scatter chart Play Axis is limited to 10 elements

In a Power Bi report I'm using a Scatter Chart (bubble) with a Play Axis (months).
But this one is limited to 10 elements (I tried years, days, weeks... always 10). Also it's not a size problem, I already tried to put it on maximum size.
And I would like to have 12 elements (all months). How can I fix that?
[https://i.stack.imgur.com/QkW7f.png]
Thanks a lot
The scatter chart does not limit the play axis to 10 items, the value for those remaining items are null/blank due to which the play axis does not show those values. Please find below the screenshot. So please check the data for those missing categories.
Thanks.