Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Shree_185
Helper I
Helper I

Format function does not support for direct query

Hi, I need your help to I how to replace the format function in the Direct query. In the last line, the Format function does not support for SQL SERVER DIRECT query.

 

Pending Customer in Days = var dayNo=INT([BMCServiceDesk__TimeSpentInCurrentStatus__c]/1440)

var hourNo=INT(MOD([BMCServiceDesk__TimeSpentInCurrentStatus__c],1440)/60)

var minuteNO=MOD(MOD([BMCServiceDesk__TimeSpentInCurrentStatus__c],1440),60)

var secondNo=INT(([BMCServiceDesk__TimeSpentInCurrentStatus__c]-INT([BMCServiceDesk__TimeSpentInCurrentStatus__c]))*60)

return

dayNo&" day "&FORMAT(hourNo,"#00")&":"&FORMAT(minuteNO,"#00")&":"&FORMAT(secondNo,"#00")

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Shree_185 ,

 

Format function is not supported in Direct Query mode in Power BI. You need to convert your connection mode to import to use it.

Or I suggest you to create two calcualted columns, one to show Days and another one to show times in time type formated as hh:mm:ss. 

Pending Customer in Days = 
VAR dayNo =
    INT ( [BMCServiceDesk__TimeSpentInCurrentStatus__c] / 1440 )
RETURN
    dayNo & " day "
Pending Customer in Times = 
VAR hourNo =
    INT ( MOD ( [BMCServiceDesk__TimeSpentInCurrentStatus__c], 1440 ) / 60 )
VAR minuteNO =
    MOD ( MOD ( [BMCServiceDesk__TimeSpentInCurrentStatus__c], 1440 ), 60 )
VAR secondNo =
    INT (
        (
            [BMCServiceDesk__TimeSpentInCurrentStatus__c]
                - INT ( [BMCServiceDesk__TimeSpentInCurrentStatus__c] )
        ) * 60
    )
RETURN
TIME(hourNo,minuteNO,secondNo)

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

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

5 REPLIES 5
ALLUREAN
Solution Sage
Solution Sage

Hi, @Shree_185 

 

If I understand correctly, these are variables that you want to change format?

Option 1: Try to create different measure for each variable and the change the format of the measure and use it

 

 

Did I answer your question? Please Like and Mark my post as a solution if it solves your issue. Thanks.

Appreciate your Kudos !!!

https://allure-analytics.com/

https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




I want to use the above lines of code and in the last line, Format function doesn't support a Direct queries.

Anonymous
Not applicable

Hi @Shree_185 ,

 

Format function is not supported in Direct Query mode in Power BI. You need to convert your connection mode to import to use it.

Or I suggest you to create two calcualted columns, one to show Days and another one to show times in time type formated as hh:mm:ss. 

Pending Customer in Days = 
VAR dayNo =
    INT ( [BMCServiceDesk__TimeSpentInCurrentStatus__c] / 1440 )
RETURN
    dayNo & " day "
Pending Customer in Times = 
VAR hourNo =
    INT ( MOD ( [BMCServiceDesk__TimeSpentInCurrentStatus__c], 1440 ) / 60 )
VAR minuteNO =
    MOD ( MOD ( [BMCServiceDesk__TimeSpentInCurrentStatus__c], 1440 ), 60 )
VAR secondNo =
    INT (
        (
            [BMCServiceDesk__TimeSpentInCurrentStatus__c]
                - INT ( [BMCServiceDesk__TimeSpentInCurrentStatus__c] )
        ) * 60
    )
RETURN
TIME(hourNo,minuteNO,secondNo)

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

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

From the Excel client with a pivot table against a PowerPivot model connected to a SQL backend, I wanted to use ManagedSets to create an MDX statement like the one below (which works). When I try and format the date to make it dynamic with now(), the format function is not known. Hence, I assume this is what this thread is about. So, after all these years, still, no decent way to get a named set out of a power pivot model with date math?

 

StrToMember("[Calendar].[Calendar Date].[2023-06-25]")
:
StrToMember("[Calendar].[Calendar Date].[2023-06-29]")

 

The only thing at the moment I can imagine is to try changing the formatting of column BMCServiceDesk__TimeSpentInCurrentStatus__c




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.