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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
unknown917
Helper III
Helper III

Dax Measure not showing total in table

I have a measure to calculate the span of time between 2 timestamps.  I have it categorized as General but have also tried decimal number.  Here is my measure below:
 
Actual Service = DIVIDE(IF(DATEDIFF(SELECTEDVALUE(Query1[Arrived Time]),SELECTEDVALUE(Query1[Completed Time]),second)=BLANK(),0,DATEDIFF(SELECTEDVALUE(Query1[Arrived Time]),SELECTEDVALUE(Query1[Completed Time]),second)),60,0)
 
When I add the measure as a column to the table visual, it does not sum the times in totals row.  I added the if statement thinking it was a null issue, but now I get 0.00 instead of nothing.
 
unknown917_0-1739222338654.png

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

SELECTEDVALUE ( ) is syntax sugar for IF ( HASONEVALUE ( ), VALUES ( ) ). The problem is that you haven't define how this should work when there are multiple times, not just a single one. It looks like you want to sum them.

 

Try this:

Actual Service =
SUMX (
    Query1,
    DATEDIFF ( Query1[Arrived Time], Query1[Completed Time], SECOND ) / 60
)

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

SELECTEDVALUE ( ) is syntax sugar for IF ( HASONEVALUE ( ), VALUES ( ) ). The problem is that you haven't define how this should work when there are multiple times, not just a single one. It looks like you want to sum them.

 

Try this:

Actual Service =
SUMX (
    Query1,
    DATEDIFF ( Query1[Arrived Time], Query1[Completed Time], SECOND ) / 60
)

Thank you @AlexisOlson !

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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