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
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
v-yuta-msft
Community Support
Community Support

@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
v-yuta-msft
Community Support
Community Support

@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.

 

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.