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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Kinga99
Helper II
Helper II

Measure SUM

Hello, I have a table visual with number of travel and non travel days per emplyee. The requirements is that each person is supposed to travel 301 days out of the year, so I am trying to make a measure that shows the difference. I need that number to sum to a total at the bottom, but it doesn't and I dont know how to apply SUMx or SUM in this example.

 

(Note: 'Labor Cost per Day'[Person Traveling) is a value of 1 or 0 in  a calendar table. If person is traveling on that day, it's 1. If not, it's 0)

 

Measure:

Days Difference =
//minimum is 43 weeks=301 days
var diff=SUM('Labor Cost per Day'[Person Traveling)
return  IF(diff>=301,0,301-diff)

 

Kinga99_0-1670943319717.png

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Kinga99 

Please try

Days Difference =
SUMX (
VALUES ( 'Labor Cost per Day'[Person] ),
CALCULATE (
VAR diff =
SUM ( 'Labor Cost per Day'[Person Traveling] )
RETURN
IF ( diff >= 301, 0, 301 - diff )
)
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Kinga99 

Please try

Days Difference =
SUMX (
VALUES ( 'Labor Cost per Day'[Person] ),
CALCULATE (
VAR diff =
SUM ( 'Labor Cost per Day'[Person Traveling] )
RETURN
IF ( diff >= 301, 0, 301 - diff )
)
)

Thank you, that worked like a charm!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors