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
Anonymous
Not applicable

Sum exclude blanks

Hi all,

 

I'm trying to figure out a way to make this work;

 

Every day a person works he will have to do multiple calls. On each call the employee is promoted to choose if it's the first visit of the day, the visit in between or the last visit of the day. If it's the first visit of the day the employee is obligated to fill in their odometer gain and when it's the last visit of the day aswel. 

 

So the data would look like this:

Date & TimeUserBegin odometerEnd odometer gain
03-06-2020 08:00 amTim14562null

03-06-2020 09:00 am

Timnull

null

03-06-2020 11:00 am

Timnull

null

03-06-2020 12:00 am

Timnull

14685

 

The sum would be: 14685 - 14562 = 123. This works perfectly. But if the employee is not yet done with his day the current sum will give me an negative number as show in the picture below. Is there anway to figure this out?

 

Thanks in advance!

 

Wrong                                                                            Good

image.png

image.png

 

 

 

 

 

KmVertrek minus KmAankomst = 
IF (
    NOT ISBLANK ( MAX('datalake answers'[KmVertrek]) ),
    ( MIN('datalake answers'[KmAankomst]) - MAX('datalake answers'[KmVertrek]) ) 
)

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , try like

sumx(filter(summarize(Table, Table[Date & Time].Date, Table[User], "_1" ,sumx(Table, Table[Begin odometer]-Table[End odometer gain])),[_1]>0),[_1])

 

Group at day and user level and then check >0

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , try like

sumx(filter(summarize(Table, Table[Date & Time].Date, Table[User], "_1" ,sumx(Table, Table[Begin odometer]-Table[End odometer gain])),[_1]>0),[_1])

 

Group at day and user level and then check >0

Anonymous
Not applicable

Hi Amit,

 

Thanks, i got it working using this formula:

 

 

KmVertrek minus KmAankomst = 
sumx(filter(summarize('datalake calls', 'datalake calls'[ActualStart].[Date], 'datalake calls'[UserId], "_1" ,sumx('datalake answers', 'datalake answers'[KmAankomst] - 'datalake answers'[KmVertrek])),[_1]>0),[_1])

 

 

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.