Date, time and Duration Function in power Query | Power BI Complete Tutorial 2024 | Power BI Course
In Power Query, which is the data transformation and preparation tool used within Power BI, you can perform various operations on date, time, and duration data types using functions provided in the M language. Below, I'll provide an overview of some common operations with examples:
Date Functions:
Date.FromText(): Converts a text string into a date.
javascript
Date.FromText("2024-03-28")
Date.ToText(): Converts a date into a text string with a specified format.
vbnet
Date.ToText(#date(2024, 3, 28), "dd-MM-yyyy")
Date.AddDays(): Adds a specified number of days to a date.
vbnet
Date.AddDays(#date(2024, 3, 28), 7)
Time Functions:
Time.FromText(): Converts a text string into a time.
less
Time.FromText("13:30:00")
Time.ToText(): Converts a time into a text string with a specified format.
less
Time.ToText(#time(13, 30, 0), "hh:mm:ss")
Time.AddHours(): Adds a specified number of hours to a time.
less
Time.AddHours(#time(13, 30, 0), 2)
Duration Functions:
Duration.FromText(): Converts a text string into a duration.
Mathematica
Duration.FromText("2:30:00")
Duration.ToText(): Converts a duration into a text string with a specified format.
arduino
Duration.ToText(#duration(0, 2, 30, 0), "hh:mm:ss")
Duration.TotalHours(): Returns the total number of hours in a duration.
arduino
Duration.TotalHours(#duration(0, 2, 30, 0))
These functions can be used within the Power Query Editor in Power BI to manipulate and transform date, time, and duration data as needed for your analysis and reporting requirements. By combining these functions with other data transformation steps, you can prepare your data effectively before loading it into your Power BI data model for visualization and analysis.
#2024 #certification #eduction #powerbi #trending #dataanalysis #youtube #dataanalyst #dataanalytics #dataanalysis #datascience #microsoft #ipl2024 #election2024news #election2024update #viralshorts #viral #memes #viralvideo #viralreels #viralcontent #trending #trendingvideo #trendingcourse #trendingstatus #trendingnews #powerbi_training #trendingnow #powerbideveloper #powerbipro #powerbiservice #powerbidashboard