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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Remove seconds from a timestamp field

Hi Team,

 

I am new to PowerBI and hence this question might be very simple but it would be very helpful if you help me with it.

 

I have a field in my table "A_Timestamp" and the value is 

01/02/18 12:08:25

I want to ignore the seconds and display the result as

01/02/18 12:08

How can this be achieved?

 

Thank you very much in advance.

 

Regards,

Ani

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

HI @Anonymous

 

You can use the formatting features in the toolbar as @Anonymous suggested.

 

Another option is to use the FORMAT function that allows you to control the format string.  To convert your date you would use FORMAT( <datevalue> , "dd/MM/YY hh:mm" )


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

6 REPLIES 6
Phil_Seamark
Employee
Employee

HI @Anonymous

 

You can use the formatting features in the toolbar as @Anonymous suggested.

 

Another option is to use the FORMAT function that allows you to control the format string.  To convert your date you would use FORMAT( <datevalue> , "dd/MM/YY hh:mm" )


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

Thank you so much Phil_Seamark. Thanks for your quick assistance.

Easily follow this:

in quesry view: Add column > Forma> Trim> Parse

This way you'll get rid of the seconds

Anonymous
Not applicable

@Phil_Seamark  knew i missed an easy one!

Anonymous
Not applicable

If it is just for display purposes, you can select the individual column and go into the Modelling Tab on the top menu.  Under there is a Data format section whereby you can choose a format that does not display the seconds.

 

 

If you are wanting to strip out the seconds for the purpose of data comparisons, you will need to perform an operation that will 'round' the seconds.  This will depend how the data is stored, but generally time is the decimal component of the Date/Time number value.  So 0 equals midnight and 1 the following midnight, with 0.5 being mid day.  This would mean that a single minute would be (1 / 24 / 60) or (1 / 1440)

If you take the number you have, multiply it by 1440 and round to zero decimal places (integer), then divide that back by 1440 and store as a decimal, you will have rounded the number.

 

Consider how you round, as you will move the time either up or down to the nearest second.  If you want to always round down, you need to use a "Floor" operation instead.

Anonymous
Not applicable

Thank you so much Ross73312 for your assistance.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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