cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
pawand23 Frequent Visitor
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 Team
Community Support Team

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 Team
Community Support Team

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
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 168 members 1,709 guests
Please welcome our newest community members: