cancel
Showing results for
Did you mean:
Frequent Visitor

## Wrong Total

Hi Everyone,

I am creating a measure, Measure = divide(sum(amount),count(task)), this is giving me incorrect total.

This is a sample data, in which the line items of Measure = divide(sum(amount),count(task)) is correct, but the total in bottom is incorrect, could you please help.

Abhishek

12 REPLIES 12
Super User

## Re: Wrong Total

Hey,

it's not totally clear, what's wrong (at least not for me)

Can you please explain what the number 11688 (Task) for Solution "A" represents

• the no of tasks meaning the number of rows filter implicitly by Solution "A"

What is your expected result? And what does the Measure = Count('tablename'[Task] return for each row and also the total value.

Regards,
Tom

Hamburg - Germany
If I answer you question, please mark my post as solution, this will also help others.
Proud to be a Datanaut!
Frequent Visitor

## Re: Wrong Total

Hi There,

What i am trying to achieve here is :

Divide sum of amount with count of task, now what i am getting in Power BI is

Now the expected result is

Basically Power BI should return the sum of the measure i.e 17500, but it is returning 2500 which is 17500/7, how can i get the sum of the measure as total in Power BI.

Thanks

Frequent Visitor

## Re: Wrong Total

Hi,

Just want to update here, i have used

and the total seems working fine for solution only, but when i drag some other dimension attribute then, it divide the values correctly, but returns an incorrect total.

Thanks,

Community Support Team

## Re: Wrong Total

and the total seems working fine for solution only, but when i drag some other dimension attribute then, it divide the values correctly, but returns an incorrect total.

What "other dimension" did you add? It looks like there are two related tables in your scenario, would you please post sample data in source tables?

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

## Re: Wrong Total

Hi,

All the fields that i have used in the screenshot, in my previous replies are from same table only.

What happening is, when i use drag solution and this measure together in form of a table, then it divides the values correctly, and the total in bottom seems correct as well.

But when i use some other dimensional attribute, for example, name then it divdes the values correctly, but the total seems to be incorrect.

The reason that, it is working fine with solution might be that i have used solution is the measure, SUMX(VALUES(table1[Solution])

that is why it is working correctly with solution.

But when i use this measure with name, then it did not worked correctly, in order to make it work for name also, i should use SUMX(VALUES(table1[Name]) instead of SUMX(VALUES(table1[Solution]).

I should not use any dimensional attribute in the values in DAX, to make it work with every dimensional attribute.

If you check my sceenshots, then you will understand what exactly i need as output.

Frequent Visitor

## Re: Wrong Total

Can anyone help on this!!

Community Support Team

## Re: Wrong Total

```Measure_2 =
SUMX (
VALUES ( Table1),
CALCULATE ( SUM ( Table1[Amount] ) ) / CALCULATE ( COUNT ( Table1[Task] ) )
)```

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

## Re: Wrong Total

Hi Yuliana,

I have already used this calculation. It seems working fine.

But i do not want to use values function here, as it will restrict the output to provide correct results for the table that i have used with values function.

What i want is, it should give correct result with any dimensional attribute, which has a relationship with this table from which amount is used.
Community Support Team

## Re: Wrong Total

With above measure using VALUES(TableName) instead of VALUES(TableName[Column]), whichever dimension being added into table visual, Total rows returns correct result. You could test with name and solution or any other field.

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.