Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
PBI5851
Helper V
Helper V

How to calculate sum of a measure

Hello, 

I have the below raw data 

PersonIDTravelDateContactCount
John11/1/20235
John11/2/20236
John11/3/20233
Nick11/1/20234
Nick11/2/20237
Steve11/3/20235
Mary11/2/20233

 

 

For each person, there is a goal and the way i did it is to create two measures. 

1)maxperson = max(MainTable[PersonID])

and then 

2) persongoal = IF(MainTable[maxperson] ="Mary",8,10)

 

At the end i display the goal filled %. Now, i expect to have the result as 

PersonIDContactCountGoalGoalFilled
John1410140%
Nick1110110%
Steve51050%
Mary3838%
Total333887%

 

But i get the result as below.

PersonIDContactCountGoalGoalFilled
John1410140%
Nick1110110%
Steve51050%
Mary3838%
Total3310330%

 

The columns work, but the total gets messed up. Any recommendation on how to fix the total . 

PBI5851_0-1700503547457.png

Thank you.

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

It's a measure totals issue.

Try

SUMX(VALUES(MainTable[PersonID]),IF ([maxperson] ="Mary", 8,10))

 

--

As a convention when we use a measure in another measure, we don't precede it with the table name

View solution in original post

1 REPLY 1
HotChilli
Super User
Super User

It's a measure totals issue.

Try

SUMX(VALUES(MainTable[PersonID]),IF ([maxperson] ="Mary", 8,10))

 

--

As a convention when we use a measure in another measure, we don't precede it with the table name

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.