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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.