Wrong Total in Power BI - powerbi

I am creating a measure, Measure = divide(sum(amount),count(task)), this is giving me incorrect total.
This is what I am getting in Power BI.
Now the result which is expected here is
Basically what I want is to get the total of the measure that I have created, Power BI is dividing the total sum with the total count.

The answer could be quite mundane.
Instead of the Measure = divide(sum(amount),count(task)) you may instead be wanting to use:
Measure = SUM(amount)
The divide(sum(amount),count(task)) measure is a longhanded way of calculating the mean (AVERAGE being the shorthand way). But what you seem to require is the SUM.

Related

AVERAGE total for measure in Power BI - dax

I am facing with AVG total problem. I would like to use the automatic AVG total calculated from measure. I tried to fix this with HASONVALUE function but it gives me the same result as before and still wrong. Do you have any suggestions?
Measure
Table

HASONEFILTER SUMX total not calculating correctly

I am creating a Power BI measure that sums up averages so I have used the HASONEVALUE SUMX method but the total doesn't match what the actual sum would be if you just add up the information. Here is the measure:
And here is the results:
The total shows 31,654.25 but if you add up the rows you actually get 22,962.33. I am wondering if there is something wrong with my measure or if it is an issue of me not realizing it is pulling in additional information I'm not aware of.
This is calculating the average over all of the selected contracts and then summing that same value for each selected contract. (When you define a variable, it's treated as a constant in the remainder of the measure definition.)
Adding to #Alexis Olson, the average in a row is for the group, the total count is for entire datatable.
Below table is grouped by column A. Sum of averages is not equal to total average

How to bring the measure total to rows in Power BI?

I have a measure in Power BI. How to bring the measure total to rows in power BI ?
You have to use ALL table function to compute this:
YourNewMeasure = SUMX(ALL(YourTableName),YourTableName[Quantity])
Balaji has rightly given the formula to get the total in each row, just wanted to add that now you have to create a column and use the above formula instead of a measure.

Power Bi Calculating number of days dynamically

I am using a slicer to determine a certain periode of time (e.g. 01.10.19 - 31.10.19) and now I want Power Bi to calculate how many days are included (in this case it would be: 31). Of course the calculation needs to be updated every time I use the slicer. Is there any possibility to do so? I have literally no idea...
Create a measure to calculate the difference between the max and min dates in your date table, which is filtered by this slicer. You can use DATEDIFF function for that. In this case the number of days will be calculated as:
Number of days = DATEDIFF(MIN('Calendar'[Date]); MAX('Calendar'[Date]); DAY) + 1

Pareto Chart with a Percentage Measure Power BI

I'm having an issue with a dashboard that I'm creating.
I need to make a Pareto Chart and I found a lot of tutorials on the Internet of how to make it in Power BI, however, I need to use a measure that is a percentage and this is where I'm stuck.
Here's a part of my table:
I made a measure that is a percentage of Não_Recebido_Dinâmico by Fat_Liq1. The measure is:
% Inadimplência_Dinâmico = DIVIDE(SUM('Mapa_de_Faturamento (2)'[Não_Recebido_Dinâmico]);
SUM('Mapa_de_Faturamento (2)'[Fat_Liq.1])) + 0
So I need to make a Pareto Chart with the top 10 Cursos by this measure. When I apply the ways of the Pareto Chart on the Internet it doesn't work because they use the total of the measure to make the accumulated percentage.
For example, these are the top 10 Cursos by the measure % Inadimplência_Dinâmico. I think that to make the Pareto Chart works properly, the total and the accumulated should be the sum of the measure, but that's not what happens in Power BI because it keeps considering it as a percentage.
I've tried to make the same measure as a calculated column but it doesn't work either, because in this case, it sums up the percentage of all rows.
I'm not familiar with the DAX functions of Power BI, so I need some help.
This is what I want in Power BI, but made in Excel:
Thank you all!
First, let's create a calculated column for the ranking (names abbreviated for legibility):
Ranking = RANKX(
SUMMARIZE('Mapa_'; 'Mapa_'[Curso]);
CALCULATE(
DIVIDE(SUM('Mapa_'[Não_]); SUM('Mapa_'[Fat_]));
ALL('Mapa_');
'Mapa_'[Curso] = EARLIER('Mapa_'[Curso])))
Now we can create a cumulative measure:
Accum = DIVIDE(
CALCULATE(
SUM('Mapa_'[Não_]);
FILTER(ALLSELECTED('Mapa_');
'Mapa_'[Ranking] <= MAX('Mapa_'[Ranking])));
SUM('Mapa_'[Fat_]))
Now you can create a Line and Bar Chart with Curso on the shared axis, % Inadimplência_Dinâmico on the column values, and Accum on the line values.
Note that this will have all of the cursos until you apply appropriate filtering. To do this, go to the visual level filters (or page level or report level) and choose Top N filtering for Curso. You want to show the Bottom 10 item using the Ranking column as for the By value choice.
The ALLSELECTED part of the Accum measure will make sure you're only including the top 10 that you want and not all of the rows.