cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Microsoft Phil_Seamark
Microsoft

Re: Remove seconds from a timestamp field

HI @Anonymous

 

You can use the formatting features in the toolbar as @Ross73312 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
Ross73312 Super Contributor
Super Contributor

Re: Remove seconds from a timestamp field

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.


   

              Did I answer your question? Mark my post as a solution!
       

Proud to be a Datanaut!


   


Microsoft Phil_Seamark
Microsoft

Re: Remove seconds from a timestamp field

HI @Anonymous

 

You can use the formatting features in the toolbar as @Ross73312 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

Ross73312 Super Contributor
Super Contributor

Re: Remove seconds from a timestamp field

@Phil_Seamark  knew i missed an easy one!


   

              Did I answer your question? Mark my post as a solution!
       

Proud to be a Datanaut!


   


Anonymous
Not applicable

Re: Remove seconds from a timestamp field

Thank you so much Ross73312 for your assistance.

Anonymous
Not applicable

Re: Remove seconds from a timestamp field

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

Alirezam Regular Visitor
Regular Visitor

Re: Remove seconds from a timestamp field

Easily follow this:

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

This way you'll get rid of the seconds

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors