cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## Incorrect Measure Total

Hi everyone!

Hope you can help me this time

I am performing the analysis and I need to show the correct total of the measure.

Here is an  example of the table on which I am working now and the column which I should calculate. This column is a measure (actions/hours).

I tried to use this formula but ot doesnt give the correct total.

Total test =
var Actions = DIVIDE('General'[Actions],'General'[Total Hours],0)
return if
(HASONEFILTER('General'[Person]), Actions, sumx(values('General'[Person]),actions))

Thank you!!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User

## Re: Incorrect Measure Total

Hi @Anonymous,

Change you measure to something like this

```Total test =
VAR Actions =
DIVIDE ( 'General'[Actions], 'General'[Total Hours], 0 )
RETURN
IF (
HASONEFILTER ( 'General'[Person] ),
Actions,
SUMX ( ALLSELECTED ( 'General'[Person] ), Actions )
)```

Regards,

MFelix

Proud to be a Datanaut!

Highlighted
Super User

## Re: Incorrect Measure Total

To wha I could get from your sample file your issue is regarding the way you calculate your measures so the best way is to create the following measures:

```Actions =
IF (
HASONEFILTER ( Table[Name] );
DIVIDE ( [Actions Measure]; [Hours Measure]; 0 );
SUMX (
ALLSELECTED ( Table[Name] );
DIVIDE ( [Actions Measure]; [Hours Measure]; 0 )
)
)```

```Total hours Worked Total =
IF (
HASONEFILTER ( Table[Name] );
[Hours Measure];
SUMX ( ALLSELECTED ( Table[Name] ); [Hours Measure] )
)
```

The Actions Measure and Hours Measure are your two base measures that you can use to make the calculations.

Regards,

MFelix

Proud to be a Datanaut!

8 REPLIES 8
Established Member

## Re: Incorrect Measure Total

@Anonymous

What's the purpose of using hasonefilter formula? I think  DIVIDE('General'[Actions],'General'[Total Hours],0) can work correct.

Thanks and BR

Ryan

Anonymous
Not applicable

## Re: Incorrect Measure Total

Because using just divide function it doesnt show the correct total of the column.

As there is a Person filter (for each row) I used hasonefilter to calculate total.

Super User

## Re: Incorrect Measure Total

Hi @Anonymous,

Change you measure to something like this

```Total test =
VAR Actions =
DIVIDE ( 'General'[Actions], 'General'[Total Hours], 0 )
RETURN
IF (
HASONEFILTER ( 'General'[Person] ),
Actions,
SUMX ( ALLSELECTED ( 'General'[Person] ), Actions )
)```

Regards,

MFelix

Proud to be a Datanaut!

Anonymous
Not applicable

## Re: Incorrect Measure Total

Hi @MFelix,

However it gives me a strange total:

Established Member

## Re: Incorrect Measure Total

Hi @Anonymous

Can you share some base data or the pbix

Regards

Affan

Anonymous
Not applicable

## Re: Incorrect Measure Total

Unfortunately I can't share it due to confidentiality

Super User

## Re: Incorrect Measure Total

Hi @Anonymous,

I send out a response to you message, please check it.

Regards,

Mfelix

Proud to be a Datanaut!

Highlighted
Super User

## Re: Incorrect Measure Total

To wha I could get from your sample file your issue is regarding the way you calculate your measures so the best way is to create the following measures:

```Actions =
IF (
HASONEFILTER ( Table[Name] );
DIVIDE ( [Actions Measure]; [Hours Measure]; 0 );
SUMX (
ALLSELECTED ( Table[Name] );
DIVIDE ( [Actions Measure]; [Hours Measure]; 0 )
)
)```

```Total hours Worked Total =
IF (
HASONEFILTER ( Table[Name] );
[Hours Measure];
SUMX ( ALLSELECTED ( Table[Name] ); [Hours Measure] )
)
```

The Actions Measure and Hours Measure are your two base measures that you can use to make the calculations.

Regards,

MFelix

Proud to be a Datanaut!

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 142 members 1,893 guests
Recent signins: