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

Seconds to Duration in Direct Query

Hello all,

I have a column with seconds. I created another column to convert it to duration. Whenever I create that column and do the conversion, it tells me that this step results in a query that is not supported in DirectQuery mode. Is there a way for me to do this conversion while still in DirectQuery mode? Thanks. 

1 ACCEPTED SOLUTION

You might try using a DAX column instead. https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

Did you create that column in Power Query M code or in DAX?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

I made the column in power query M code

You might try using a DAX column instead. https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Okay, it is working perfectly. One other question. How would I go about getting the sum and average of the dax column. It has told me that it is a string but when i convert it to datetime it still tells me that sum is not supported in direct query. Any suggestions? 

Ah yes, that is a downside. What about this update that I wrote a while ago:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/td-p/793639

 

?

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

It worked, thank you for all your help! Sorry to continue this thread but I have one last question. So I've already done some filtering in power query for that data set. I used that measure but found out that it takes into account all the data before the filtering done in power query. Are dax and power query independent of each other as in I would also need to filter out in dax the way I made filters in power query? Once again thanks for all your help. 

Yes, Power Query (M code) is executed as data is loaded into the model. DAX is essentially executed after the data is loaded into the model. They are definitely independent of one another. 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.