Power BI

Introduction To DAX and Its Data Types

In our Power BI training across Australia, we offer Power BI Basic, Power BI Advanced, and Power BI DAX course. Power BI DAX is the most advanced course because it involves a lot of understanding of the DAX language, which helps in enriching your data model and extracts information out of raw data.

In this blog post, an introduction to the Data Analysis Expression (DAX) language, which is developed by Microsoft for data analysis, has been presented.

What is DAX?

DAX Stands for Data Analysis Expressions. It is a formula language developed by Microsoft to interact with data in your data model. DAX is a formula language and NOT a programming language.

DAX helps you to enrich your data by obtaining more information from the data that you already have. DAX is a collection of functions, operators, and constants that can be used in a formula, or an expression, to calculate and return one or more values.   

Here are some examples where simply importing data into Power BI will not work and DAX code will be the only solution:

  • Analyze growth percentage across product categories.
  • Finding profit margin percentage for products and product categories.
  • Calculate year-over-year growth.
  • Compare your brand’s growth rate with that of competitors.
  • Analyze your product’s performance over different date ranges.

DAX formulas provide this capability and many other important capabilities as well.

What are the Data types in DAX

Like all other data-driven languages, DAX also has some data types. The data types in DAX can be divided into three categories: numerical, non-numerical, and variant:

1. Numerical data types:

  • Integer: The integer data type stores 64-bit value.
  • Decimal: The decimal data type is stored as a double-precision floating-point value.
  • Currency: The currency data type is internally stored as a 64-bit integer value divided by 10,000. It represents four decimal points. Summing or subtracting currency data types always ignores decimals beyond the fourth decimal point. The default format of the currency data type includes the currency symbol.
  • Date Time: This data type uses a floating-point number internally, wherein the integer corresponds to the number of days since December 30, 1899, and the decimal part identifies the fraction of the day. Hours, minutes, and seconds are converted to decimal fractions of a day.
  • Boolean: This data time is used to express logical conditions such as TRUE and FALSE.

2. Non-numerical data types:

  • Binary objects: This data type is used to store non-structural information such as images.
  • Strings: The string data type in Power BI is case-insensitive and accent-sensitive. Every string in DAX is stored as a Unicode string, where each character is stored in 16 bits.

3. Variant Data Type:

The Variant data type is used for expressions that might return different data types, depending on the conditions. As an example consider the following expression.

A DAX measure or in general a DAX expression can have a variant data type. However, any column in a regular table cannot have a variant data type.

It is important to note that formatting the strings doesn’t change their data type.

Conclusion:

DAX is one of the most powerful tool available in Power BI. It gives the core abilities needed to improve data models with computations. This blog provides a fundamental introduction to DAX and its data types to comprehend it from a business and technical perspective.

Back to list

Leave a Reply

Your email address will not be published. Required fields are marked *