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. However, because DAX is the largest and most well-known language usedin several calculationsin Power BI, a lot of people don't have any idea about the feature available in Power Query. In this blog , I'll discuss how easy it can be to calculateAge for PowerBI by using PowerBI. This methodis very helpful for situations when it is necessary to calculate the calculation of age.can be done in a previous row-by-row basis.

Calculate Age from a date

This is an example of the DimCustomer table , and it is from the AdventureWorksDW table which functions as the column for birth dates. I've eliminated columns that aren't needed in order to make it more clear;

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

  • In Power BI Desktop, Click on Transform Data
  • In the PowerQuery Editor window, make sure to choose the column titled Birthdate first.
  • You can go to the add Column Tab located under the "From Date & Time" section, and under Date, select Age

That's about it. This will calculate any differences within the Birthdate column, as well as the current date and hour.

However, the age you can see when looking at the Age column, doesn't look like an actual age. It's because it's not a duration.

Duration

Duration is a particular type of data that is utilized for Power Query which represents the distinction between the two DateTime values. Duration is a mixture of four values:

days.hours.minutes.seconds

and that's what you'll see in the information above. However, from a users' point of view, they shouldn't be required to read information in the same way as those mentioned above. There are many ways to locate every component of time. Through the Duration menu you'll see that you can extract the quantity of seconds, minutes, hours days , and even years from it.

To assist in calculating the age in years for instance it is easy for you to reach the Total Year:

Be aware that the duration of the event is measured in days . It was then divided by 365 for the year to get the total.

Rounding

Truthfully, no one has stated how old their baby is. 53.813698630136983! They say 53, which is an rounded down. It's very easy to select Rounding option , and then to round down to the Transform tab for it.

This will give you the years of experience:

You can then tidy other columns as you'd like (or there's a chance that you've used transformations using the Transform tab to stop creating new columns) This column is then referred to as column"Age".

Things to Know

  • Refresh The age calculated this way will be modified at the time of refreshing your data. Every every time it is refreshed, it'll match the birthdate to the date of the day and the time the refresh was made. This method is an earlier calculation of age. If, however, you'd like your age calculation to be conducted dynamically, using DAX This is the method I've shown you how you can make use of.
  • The motive for using Power Query: Benefits of performing an age calculation by using Power Query is that the calculation is carried out after you refresh the report. It's done with an algorithm that makes the calculation more easy to do, and there won't be any additional overhead when calculating it using DAX for a measurement of of runtime.
  • Different scenarios. This isn't meant to be used for calculation of the age of a person based on their birth date. This could be used in conjunction with inventory of products and distinct 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 earned a BSc and MSc Computer engineering. He have more that 20 years of experience in data analysis , the BI and databases fields, as well as programming and development generally using Microsoft technologies. He was a Microsoft Data Platform MVP for nine consecutive years (from 2011 until the present) for his passion and dedication to Microsoft BI. Reza is a regular blog writerand director and co-founder of RADACAD. Reza is also co-founder as well as co-organizer of Difinity the conference that is held 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 a number of books about MS SQL BI and also is working on other books. He also was a regular member of online forums on technical issues , such as MSDN and Experts-Exchange, and was moderator on the MSDN SQL Server forums, and holds an MCP and the MCSE, as well as an MCITP in Business Intelligence. He was the creator of the New Zealand Business Intelligence users group. He's also the author of very popular books Power BI from Rookie to Rock Star, which is available for download for free and includes more that 170 pages of content. It also contains The Power BI Pro Architecture published by Apress.
It is an International speaker on 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 ambition is to help you find the ideal solutions for data. He's a Data enthusiast.This post was posted 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 good tool to save to your bookmarks.

Post navigation

Create Different Visual Pages by using different security groups in Power BIAge's Calculation of Years that is used for Leap Year in Power BI by making use of Power Query

Comments

Popular posts from this blog

Alliance Meaning In Tamil - தமிழ் பொருள் விளக்கம்

Random Number Generator

Shani Dev Chalisa Hindi