Age Calculation

Age Calculation in Power BI using Power Query

Power Query has a simple method that's a basic method for calculating the age. But, since DAX is the most well-known language usedin several calculationsin Power BI, a lot of people don't have any idea about the functions available in Power Query. In this article, I'll explain how easy it is to calculateAge for PowerBI by using PowerBI. It is a methodis extremely useful when it is necessary for the calculations for age.can be calculated from an earlier calculated row-by-row basis.

Calculate Age from a date

This is an example of the DimCustomer table , which is an AdventureWorksDW table that serves in the capacity of the date-of-birth column. I've removed columns that aren't necessary to make it easier to read;

For you to calculate your age every customer, you will need:

  • In Power BI Desktop, Click on Transform Data
  • In Power Query Editor window, make sure to choose the Birthdate column first.
  • Go to the add Column Tab that is beneath the "From Date & Time" section. And under Date, select Age

That's all there is to it. This calculates the calculate any differences from the Birthdate column, and the current date and hour.

The age you see when you look into the Age column doesn't appear like an age. It's because it's an actual duration.

Duration

Duration is a unique type of data that is utilized by Power Query which represents the distinction between two DateTime values. Duration can be described as a mixture of four different values:

days.hours.minutes.seconds

and that's what you'll find in the above information. But from a user's viewpoint, they shouldn't be required to read details like the ones above. There are methods to retrieve each component of the time. Utilizing the Duration menu, you'll see that you can extract the quantity of minutes, seconds, hours, days , and even years from it.

In order to assist in calculating the age in years for instance , it is simple for you to reach Total Year:

Be aware that the duration of the event is measured in days , and then divided in 365 to calculate the year-long amount.

Rounding

In reality, no one has stated an age for their children as 53.813698630136983! They state 53, which is reduced to. It's easy to select the Rounding, then click round down on the Transform tab.

This will give you the number in years:

It is then possible to cleanse other columns if you'd like (or there's a chance that you have applied transformations using the Transform tab to prevent the creation of new columns) Then, you can name this column; Age:

Things to Know

  • Refresh The age that is calculated in this manner will be altered at the time of refreshing your data. Every refresh, the data will match the birthdate to the date and day that the refresh of the database took place. This method is an earlier calculation of age. If you wish for the age calculation to be dynamically performed, using DAX This is the approach I've shown you how you can make use of.
  • The rationale behind Power Query: Benefits of performing an age calculation with Power Query is that the calculation is carried out every time you refresh your report. The calculation is performed using an algorithm that makes the calculation easy, and there will not an additional cost in calculating it with DAX to measure runtime.
  • Different scenarios. This isn't designed to calculate the age of a person based on their birth date. This could be used in conjunction with product inventory age and the different dates and dates from each other.

Video

REZA RAD

TRAINER, CONSULTANT, MENTORReza Rad is a Microsoft Regional Director, an Author, Trainer, Speaker and Consultant. He is a graduate of a BSc with a major in Computer engineering. He has more than 20 years of experience in data analysis , BI, databases, programming and development mostly using Microsoft technologies. He has been a Microsoft Data Platform MVP for nine years in a row (from 2011 to the present) due to his dedication to Microsoft BI. Reza is a regular blog writer, and the founder and the editor for RADACAD. Reza is also the co-founder and organizer of Difinity the conference that is held at New Zealand.
His articles on different aspects of technologies, especially on MS BI, can be found on his blog: https://radacad.com/blog.
He co-authored several books on MS SQL BI and also is working on other books. He also was a regular participant in forums online for technical issues such as MSDN and Experts-Exchange as well as moderator for the MSDN SQL Server forums, and is an MCP , MCSE as well as an MCITP in BI. He was the creator of the New Zealand Business Intelligence users group. In addition, he's also an author of the extremely popular books Power BI from Rookie to Rock Star, which is available for download for free and includes more that 700 pages of content as well as Power BI Pro Architecture, which is the Power BI Pro Architecture published by Apress.
This speaker has been an International speaker for Microsoft Ignite, Microsoft Business Applications Summit, Data Insight Summit, PASS Summit, SQL Saturday and SQL Users Groups. And He is a Microsoft Certified Trainer.
Reza's aim is to help you find the ideal solutions for data. He's a Data enthusiast.This entry was filed as Power BI, Power BI from Rookie to Rockstar, Power Query and included in Power BI, Power BI from Rookie to Rock Star, Power Query. This is a fantastic source to bookmark.

Post navigation

Create Different Visual Pages by using Different Security Groups within Power to use BIAge's Calculation of Years that is used to calculate Leap Year in Power BI by making use of Power Query

Comments

Popular posts from this blog

scientific and graphing calculators

convert-to-bmp

Conor McGregor