Age Calculation

Age Calculation in Power BI using Power Query

Power Query has a simple method to calculating the age. But, because DAX is the largest and most commonly used language usedin numerous calculationsin Power BI, many are unaware of this feature in Power Query. In this blog post I will demonstrate how simple for you to calculateAge using Power BI in Power BI. The methodis extremely helpful for situations in which you require be able to calculate the calculation of age.can be made on a previously calculated row-by -row basis.

Calculate Age from a date

Here is the DimCustomer table, which is one of AdventureWorksDW table which contains the column for birthdates. I've removed some of the columns that don't need to be there for clarity;

To calculate the age of each client is, all you need to do is:

  • In Power BI Desktop, Click on Transform Data
  • In the Power Query Editor window; choose the first column, Birthdate.
  • To add a column, click on the Column Tab and then click on the "From Date & Time" section, and under Date Choose the appropriate age range.

This is all there is to it. This is the method to calculate what's the proportion between the Birthdate column as well in the current date and time.

However, the age that appears in the Age column does not appear to be an age. This is due to the fact that it's an actual duration.

Duration

Duration is a special type of data used for Power Query which represents the difference between Two DateTime values. Duration is made up from four different numbers.

days.hours.minutes.seconds

This is how you read the above values. But from the perspective of the user, it's not their responsibility to understand the specifics of this. There are ways to make each section of time. By selecting the Duration menu you'll be able see the quantity of minutes, seconds, hours, months and days from it.

In order to aid the process of calculating the age in years such as, for instance it is simple to choose Total Years.

It is vital to keep in mind how the length is calculated in days, and following that, divided by the number of days to provide you with the annual amount.

Rounding

At the final point, nobody declares that your age is 53.813698630136983! They claim 53, which is reduced to. It's very easy to select Rounding then then the Round Down option from the Transform tab.

This will tell you the years-old age:

After that, you are able to clean the other columns if you wish (or it could be that you have used transformations in the Transform tab to stop the creation of new columns) The column may be renamed as Age the column.

Things to Know

  • Refresh The age calculated by this method will be updated whenever you refresh your data. Each time, it'll match the birth date with the date and date that the refresh was completed. It is a method involves an algorithm used for pre-calculating the age. If, however, you want the calculation of the age to be performed dynamically by DAX This article will explain the method that you can employ.
  • What's the reason? Power Query: Benefits of using age calculation with Microsoft Power Query is that the calculation is carried out while you refresh your report. It's performed with an application that makes the calculation easier and there is no additional cost in doing it using DAX as a measure of time.
  • Additional scenarios This is not a method to calculate age solely by birthdate. It can be used to calculate the time of inventory for items and also to determine the differences between dates and times that differ from one another.

Video

REZA RAD

TRAINER, CONSULTANT, MENTORReza Rad is a Microsoft Regional Director, an Author, Trainer, Speaker and Consultant. He holds an BSc of Computer Engineering. He has more than twenty years of experience in the field of data analysis and programming, BI, databases and development that is mainly based on Microsoft technologies. He has been an official Microsoft Data Platform MVP for nine consecutive years (from 2011 to the present) for his dedication towards Microsoft BI. Reza is known as a prolific writer and co-founder with RADACAD. Reza is also co-founder and co-organizer of the Difinity Conference located in New Zealand.
His articles on different aspects of technologies, especially on MS BI, can be found on his blog: https://radacad.com/blog.
He has also written a few works regarding MS SQL BI and also is writing other books. He also was a frequent participant on technical forums online such as MSDN and Experts-Exchange and was moderator on the MSDN SQL Server forum, and holds the MCP and MCSE as in addition to the MCITP for BI. He is the founder of the New Zealand Business Intelligence users group. He is also responsible for the creation of the highly loved publication Power BI from Rookie to Rock Star, which is free and contains greater than 17,000 pages of data and Power BI Pro Architecture, which is the Power BI Pro Architecture published by Apress.
This speaker has been an International speaker at Microsoft Ignite, Microsoft Business Applications Summit, Data Insight Summit, PASS Summit, SQL Saturday as well as SQL User Groups. And He is a Microsoft Certified Trainer.
Reza's goal is to help you identify the most effective data solution. He is a Data enthusiast.This article was published by Reza on Power BI, Power BI from Rookie to Rockstar, Power Query and was tagged with Power BI, Power BI from Rookie to Rock Star, Power Query. This entry was filed under Power BI. The following entry was filed under Power BI.

Post navigation

Share different visual pages using different security groups in the Power BIAge's Year Calculation that is used to calculate the Leap Year in Power BI through Power Query

Comments

Popular posts from this blog

counting in hindi

reactiveEnergy-converter

volumeFlowRate-converter