filmov
tv
How to Get Current Date and Calculate Age in Power Query: A Step-by-Step Tutorial #querytips
Показать описание
Welcome to this tutorial on how to get the current date in Power Query. Power Query is a powerful data transformation tool that is used to retrieve, transform and load data. It is commonly used in Excel, Power BI, and other Microsoft applications. In this tutorial, we will show you how to retrieve the current date in Power Query.
To get the current date in Power Query, you can use the DateTime.LocalNow() function. This function retrieves the current date and time from your local system. However, if you only want to retrieve the current date, you can use the Date.From(DateTime.LocalNow()) function.
To use these functions, you can follow the steps below:
Step 1: Open Power Query Editor
First, you need to open Power Query Editor. You can do this by selecting the “Edit Queries” button on the Home tab of the Power BI Desktop ribbon.
Step 2: Create a New Query
Next, you need to create a new query. You can do this by selecting the “New Source” button on the Home tab of the Power Query Editor ribbon and then selecting “Blank Query”.
Step 3: Enter the Function
Once you have created the new query, you can enter the function to retrieve the current date. To do this, you can click on the “Add Column” tab on the ribbon and then select “Custom Column”. In the formula bar, you can enter the following formula: = DateTime.LocalNow() or = Date.From(DateTime.LocalNow()) if you only want to retrieve the current date.
Step 4: Name the Column
After entering the formula, you can name the column. To do this, you can double-click on the “Column1” heading in the query editor and then type a new name for the column.
Step 5: Close and Apply
Finally, you need to close and apply the changes you have made. You can do this by clicking on the “Close & Apply” button on the Home tab of the Power Query Editor ribbon.
Conclusion:
Congratulations! You have learned how to retrieve the current date in Power Query. By using the DateTime.LocalNow() or Date.From(DateTime.LocalNow()) function, you can easily retrieve the current date and use it in your data transformation projects. Thank you for watching this tutorial, and please subscribe to our channel for more Power Query tutorials.
To get the current date in Power Query, you can use the DateTime.LocalNow() function. This function retrieves the current date and time from your local system. However, if you only want to retrieve the current date, you can use the Date.From(DateTime.LocalNow()) function.
To use these functions, you can follow the steps below:
Step 1: Open Power Query Editor
First, you need to open Power Query Editor. You can do this by selecting the “Edit Queries” button on the Home tab of the Power BI Desktop ribbon.
Step 2: Create a New Query
Next, you need to create a new query. You can do this by selecting the “New Source” button on the Home tab of the Power Query Editor ribbon and then selecting “Blank Query”.
Step 3: Enter the Function
Once you have created the new query, you can enter the function to retrieve the current date. To do this, you can click on the “Add Column” tab on the ribbon and then select “Custom Column”. In the formula bar, you can enter the following formula: = DateTime.LocalNow() or = Date.From(DateTime.LocalNow()) if you only want to retrieve the current date.
Step 4: Name the Column
After entering the formula, you can name the column. To do this, you can double-click on the “Column1” heading in the query editor and then type a new name for the column.
Step 5: Close and Apply
Finally, you need to close and apply the changes you have made. You can do this by clicking on the “Close & Apply” button on the Home tab of the Power Query Editor ribbon.
Conclusion:
Congratulations! You have learned how to retrieve the current date in Power Query. By using the DateTime.LocalNow() or Date.From(DateTime.LocalNow()) function, you can easily retrieve the current date and use it in your data transformation projects. Thank you for watching this tutorial, and please subscribe to our channel for more Power Query tutorials.