cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pawand23
Frequent Visitor

Error in calculating duration

Hello Everyone,

 

I have a requirement where I have direct connection from SAP HANA  for Cube views. In one of the view, I have start date, end date, start time and end time. As this is direct query, all fields are getting detected as text fields. 

 

When I go to edit query mode, I can see date and time for each field as shown below,

date and time fields.PNG

 

 

As this is direct query, I can not change the data type. 

 

If I try to see those data in report, I see some fields got trimmed as shown below,

date time in report.PNG

 

 

Can someone help me why this is happening. 

 

My end goal is to find duration by formula, [Field of type DATS.1][Field of type TIMS.1] -  [Field of type DATS][Field of type TIMS]

 

I can change type of date fields from modelling in menu bar but this is not working for time field. 

 

Can anyone help me how to calculate the duration with this setup. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Error in calculating duration

@pawand23 ,

 

This issue should be caused by power bi can't recognize the date format very well. Suppose you are connecting to sql server in direct query mode, you can change the date format firstly on sql server side like pattern below and thek if this issue persists after connection in power bi:

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Community Support
Community Support

Re: Error in calculating duration

@pawand23 ,

 

This issue should be caused by power bi can't recognize the date format very well. Suppose you are connecting to sql server in direct query mode, you can change the date format firstly on sql server side like pattern below and thek if this issue persists after connection in power bi:

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors