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
LegendaryTokash
Frequent Visitor

Custom Columns or Measures in a DirectQuery report

All,

 

I have a set of reports that i configured to read data from a given application database.   I love using the DirectQuery mode for these reports, as I query from a DR instance which is fresh enough to be useful, but doesn't negatively impact performance of the production database.

 

That said, I am getting data back with several columns containing time data.   These would be start times for various steps, and they are stored in their own columns.  

 

I am trying to find a method to calculate the difference in two time column values for each row.  Simplified, any given row will have a schedueld time, an actual start time, and a completed time.   I am looking to measure the time difference between at least two of them to then visualize the elapsed time that was calculated, per row. 

 

I found a couple of options - quick measures, but couldn't get it to properly measure the time difference instead of automatically reverting to counts.  Maybe i am doing it wrong?

 

I found an option to create a custom column and appropriately create a formula.  in that case, it worked, but forced the storage mode to import, instead of directquery.   I'd really like to avoid that option - but that is why I am reaching out here, to see if i can find an alternative that gets me the data I want, without having to change out of DirectQuery.

 

Thoughts?

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @LegendaryTokash

You could consider this DAX function and use it in a measure.

DATEDIFF

Syntax:

DATEDIFF(<start_date>, <end_date>, <interval>)

It returns the count of interval boundaries crossed between two dates.

 

Best Regards

Maggie

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.