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
Pucca121
Helper II
Helper II

Query changes

Hello !

 

I would like to change the hour in the query. How can I do it?

 

Thank you 🙂

 

time.PNG

 

 

2 ACCEPTED SOLUTIONS

Hi @Pucca121,

 

Select 'Edit Queries' from arrow down.

1.PNG

 

Open your power query code via clicking on 'Advanced Editor'

2.PNG

 

In your code, you just need to add the highlighted part. You should replace the #"Changed Type" and "Date" with your own scenario.

3.PNG

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

@MarcelBeug

 

It worked. I will see if my problem is resolved 🙂

Thank you sooo much!

 

P.

View solution in original post

19 REPLIES 19
MarcelBeug
Community Champion
Community Champion

There are many ways to change the hour. What would be the desired result?

The solution may depend on wether any time zones are involved or not.

Specializing in Power Query Formula Language (M)

Only one time zone is involved. I would like to put it at 00:01:00 (one minute past midnignt)

Thank you

 

P.

Hi @Pucca121,

 

As @MarcelBeug suggested, this query code works fine in my test, I could get the desired result. If it also apply to your scenario, please kindly mark it as an answer so that someone else having similar requirement can find the solution more easily. If not, please feel free to ask.

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

In the query editor (M) you can add a duration of 1 hour and 1 minute, e.g. with the following code, in which "PreviousStep" is the name of your previous step in the query code:

= Table.TransformColumns(PreviousStep,{{"DateTime", each _ + #duration(0,1,1,0), type datetime}})

 

 

Specializing in Power Query Formula Language (M)

Hello @MarcelBeug

 

Where do I put this code? And I don't understand what is my PreviousStep.

I never did this type of tranformation in the query editor.

 

 

Thank you so much for your help!

 

P.

 

Hi @Pucca121,

 

Select 'Edit Queries' from arrow down.

1.PNG

 

Open your power query code via clicking on 'Advanced Editor'

2.PNG

 

In your code, you just need to add the highlighted part. You should replace the #"Changed Type" and "Date" with your own scenario.

3.PNG

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yulgu-msft

 

 

It doesn't work -...-

 

#change type is the name of the column ?

#date is the category ?

 

and what did you put behind the "=" sign?

 

Do you have "to close and apply" to make it work and see a change in the column ?

 

Thank you so much!

@Pucca121

 

2.PNG

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Also notice that the identifier after "in" must be the last step name before "in".

Specializing in Power Query Formula Language (M)

 

error.PNGCapture.PNG

 Hello!

@MarcelBeug@v-yulgu-msft

 

I made the changes and it returned me this error. Any ideas why?

Thank you very much

 

P.

 

Apparently you either overlooked or misunderstood my previous post.

Just change the identifier after "in" to #"Renamed Columns".

Specializing in Power Query Formula Language (M)

Capture22.PNGerror3.PNG

 

@MarcelBeug

 I modified like this and it returned me this error -.....-

Thank you so much for your time!

In the last step you use function Table.RenameColumns. This should be Table.TransformColumns.

Specializing in Power Query Formula Language (M)

@MarcelBeug

 

It worked. I will see if my problem is resolved 🙂

Thank you sooo much!

 

P.

@MarcelBeug@v-yulgu-msft

 

Thank you so much for helping me! It worked 🙂

haaa ok! Much clearer now, thank you!!

 

P:

errore.PNG

 

Hello again @v-yulgu-msft and @MarcelBeug

 

I have this error. Why?

 

Thank you

 

P.

You need to add a comma at the end of your line, numbered 17.

 

Specializing in Power Query Formula Language (M)

 

@MarcelBeug@v-yulgu-msft

 

I did that. It doesn't work.... Do you know why?

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.