Age Calculation

Age Calculation in Power BI using Power Query

Power Query has a simple way that can be used for calculating the age. But, as DAX is the primary language usedin numerous analysesin Power BI, many do not realize this option within Power Query. In this blog article, I am going to illustrate how easy it can be to calculateAge in Power BI using Power BBI. The methodis extraordinarily helpful when you have in order to calculate the estimated age.can be accomplished on an earlier calculated row-by-row row basis.

Calculate Age from a date

Here's the DimCustomer table, which belongs to the AdventureWorksDW table that is the column for birthdates. I've removed the additional columns so that it is easier to read.

If you're looking to calculate an age range for every client, the only thing you need is to:

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

This is all there is to it. This is the method you calculate any variation between the Birthdate column, in addition to the current date and date.

However, the age appears in"Age", but the Age column, however, it does not appear to be a real age. That is because it is an actual duration.

Duration

Duration is a distinct type of data kind of the type 'data' in Power Query which represents the distinction between the two DateTime values. Duration is made up of four numbers:

days.hours.minutes.seconds

and that is how you read the information above. But from a user's perspective, don't believe that they'll be able to understand specifics such as the ones listed above. There are different ways to make each section of time. If you click on the Duration menu you will see that you can determine the amount of seconds and minutes and hours, days, and even years from it.

For assistance with calculating the age in years for instance , just click the Total Year:

Be aware that the duration is calculated using days. Then it is multiplied by days to give you the yearly value.

Rounding

In the end, nobody claims to be 53.813698630136983! The number is 53. then round down. It's simple to select Rounding and then round down on your Transform tab.

This will provide you with the years of age:

Then , you can clean up the other columns you'd like to (or it could be that you've utilized transforms within the Transform tab to avoid creating new columns.) This column can be named. column: Age.

Things to Know

  • Refresh The age that is calculated by this method will be updated every time refresh of your data. And each time, it will match the birth date to the time and date at the time of refresh. This method is an earlier calculation of the age. If you require the calculation be made dynamically using DAX here's how I explained the procedure to use.
  • What's the explanation? Power Query Benefits of using the feature for age calculation in Power Query includes that it is executed each time you refresh your report. The calculation is carried out using an algorithm that makes the calculation simpler and quicker, and there's no extra expense to calculate it with DAX for a measurement of of runtime.
  • Alternative scenarios It's not in the calculation of age just from the birthdate. This can be used to calculate the age of inventory in the case of products as well as the difference between two dates or times one another.

Video

REZA RAD

TRAINER, CONSULTANT, MENTORReza Rad is a Microsoft Regional Director, an Author, Trainer, Speaker and Consultant. He earned an BSc in Computer engineering. He has more than twenty years' expertise in data analysis database, BI, programming and development, mostly using Microsoft technologies. He is a recognized Microsoft Data Platform MVP for nine consecutive years (from 2011 until the present) due to his commitment to Microsoft BI. Reza is a prolific journalist , and is co-founder for RADACAD. Reza is also co-founder as well as coordinator of Difinity event as well as the Difinity conference and Difinity conference 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 written several books on MS SQL BI and also is writing a few additional. He is also a frequent member of online forums for technical questions like MSDN and Experts-Exchange and was also the moderator on MSDN SQL Server forums, and is a holder of an MCP, MCSE, and the MCITP for Business Intelligence. He is the Director of the New Zealand Business Intelligence users group. Also, he's the co-author of the highly acclaimed volume Power BI from Rookie to Rock Star, which is free and contains nearly 700 pages worth of information in addition to The Power BI Pro Architecture published by Apress.
This speaker has been an International Speaker of Microsoft Ignite, Microsoft Business Applications Summit, Data Insight Summit, PASS Summit, SQL Saturday along with SQL user groups. And He is a Microsoft Certified Trainer.
Reza's main goal is to help users locate the best information solution. He is Data enthusiast.This post was categorized in Power BI, Power BI from Rookie to Rockstar, Power Query and included in Power BI, Power BI from Rookie to Rock Star, Power Query. The following is a great guide to bookmark.

Post navigation

Share various visual pages by using different Security Gruppen in Power BI's BIAge's years calculation that is used to calculate Leap Year in Power BI by using Power Query

Comments

Popular posts from this blog

Random Number Generator

best calculator for school

Is Scientific Calculators still up and running? [closed]