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
Tihannah
Resolver I
Resolver I

Time Format canceling out filters in table?

I have a table with employee names and stats and had to apply filters done with DAX to filter out termed employees and those with no stats. I have Avg Time metrics converted using a time conversion dax that changes seconds to hours:minutes:seconds.  HOWEVER, when I add these metrics to my table, it's canceling out all my filters, including those in a slicer that filters by Dept or Property. If I add the metrics in the second format, it's fine. It's only when I add them in the full time format. Below is the time converion DAX I'm using. Can anyone tell me why this is happening or how I can fix it? I've used these time formats in tables before with no problem, but I didn't have all of the filters to sort the data.

 

Avg_Time =
// Duration formatting
// * @konstatinos 1/25/2016
// * Given a number of seconds, returns a format of "hh:mm:ss"
//
// We start with a duration in number of seconds
VAR Duration = [Avg Time]
// There are 3,600 seconds in an hour
VAR Hours =
INT ( Duration / 3600)
// There are 60 seconds in a minute
VAR Minutes =
INT ( MOD( Duration - ( Hours * 3600 ),3600 ) / 60)
// Remaining seconds are the remainder of the seconds divided by 60 after subtracting out the hours
VAR Seconds =
ROUNDUP(MOD ( MOD( Duration - ( Hours * 3600 ),3600 ), 60 ),0) // We round up here to get a whole number
// These intermediate variables ensure that we have leading zero's concatenated onto single digits
// Hours with leading zeros
VAR H =
IF ( LEN ( Hours ) = 1,
CONCATENATE ( "0", Hours ),
CONCATENATE ( "", Hours )
)
// Minutes with leading zeros
VAR M =
IF (
LEN ( Minutes ) = 1,
CONCATENATE ( "0", Minutes ),
CONCATENATE ( "", Minutes )
)
// Seconds with leading zeros
VAR S =
IF (
LEN ( Seconds ) = 1,
CONCATENATE ( "0", Seconds ),
CONCATENATE ( "", Seconds )
)
// Now return hours, minutes and seconds with leading zeros in the proper format "hh:mm:ss"
RETURN
CONCATENATE (
H,
CONCATENATE ( ":", CONCATENATE ( M, CONCATENATE ( ":", S ) ) ))

 

 

1 ACCEPTED SOLUTION
Tihannah
Resolver I
Resolver I

I figured out a work around with the filter. Thanks for the suggestions!

View solution in original post

5 REPLIES 5
Tihannah
Resolver I
Resolver I

I figured out a work around with the filter. Thanks for the suggestions!

v-easonf-msft
Community Support
Community Support

Hi, @Tihannah 

What is the ’data type‘ or ’format‘ of the calculated column?

Make sure its data type is not 'Text'.

 

Best Regards,
Community Support Team _ Eason

Data type is decimal. 

lbendlin
Super User
Super User

Do you have cases where these measure calculate to BLANK() ?

I included an IFERROR calculation to cancel out any blanks. The time formats pull through as designed. They are just canceling out all filters I have in the table so that Im getting a lot of employees that shouldn't be in there.

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.