FIXED

FIXED

How to Use the Power BI DAX function FIXED

In this article, we will learn about the DAX function FIXED and how to use it in Power BI.

What is the FIXED function in DAX?

The FIXED function in DAX is used to round a number to a specified number of digits and format it with a specific format. The function returns a text value that represents the rounded number in the specified format.

The syntax of the FIXED function is as follows:


FIXED(❰value❱, ❰decimals❱, [❰comma❱], [❰dot❱])


Where:

- `❰value❱`: The number to be rounded and formatted.

- `❰decimals❱`: The number of decimal places to round the number to.

- `❰comma❱`: Optional. A boolean value that specifies whether to use a comma as the thousands separator. The default value is FALSE.

- `❰dot❱`: Optional. A boolean value that specifies whether to use a dot as the decimal separator. The default value is TRUE.

How to use the FIXED function in Power BI

To use the FIXED function in Power BI, follow the steps below:

1. Open Power BI Desktop and create a new report.

2. Add a new measure to the report by clicking on the "New Measure" button in the "Modeling" tab of the ribbon.

3. In the formula bar, enter the following formula:


Fixed Value = FIXED(SUM(Sales[Sales Amount]), 2, TRUE, FALSE)


This formula will round the total sales amount to 2 decimal places, use a comma as the thousands separator, and a dot as the decimal separator.

4. Press Enter to create the measure.

5. Add the new measure to the report by dragging and dropping it onto the canvas.

The report will now display the total sales amount rounded to 2 decimal places and formatted with a comma as the thousands separator and a dot as the decimal separator.

Examples of using the FIXED function in Power BI

Let's look at some examples of using the FIXED function in Power BI.

Example 1: Rounding a number to a specific number of decimal places

Suppose we have a table that contains the following data:

| Product | Price |

|---------|-------|

| A | 12.345|

| B | 67.890|

| C | 123.456|

We want to create a measure that calculates the average price of the products rounded to 2 decimal places.

To do this, we can use the following formula:


Average Price = FIXED(AVERAGE(Products[Price]), 2)


This formula will calculate the average price of the products and round it to 2 decimal places.

Example 2: Formatting a number with a specific format

Suppose we have a table that contains the following data:

| Employee | Salary |

|----------|--------|

| John | 2300 |

| Jane | 4700 |

| Tom | 8900 |

We want to create a measure that calculates the total salary of the employees and formats it with a comma as the thousands separator and a dollar sign at the beginning.

To do this, we can use the following formula:


Total Salary = “$” & FIXED(SUM(Employees[Salary]), 0, TRUE, FALSE)


This formula will calculate the total salary of the employees, round it to 0 decimal places, and format it with a comma as the thousands separator and a dollar sign at the beginning.

The FIXED function in DAX is a powerful function that allows you to round a number to a specific number of decimal places and format it with a specific format. By using this function in Power BI, you can create custom calculations and visualizations that meet your specific business needs.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

Subject

Your Name (required)

Company/Organisation

Email (required)

Telephone

Training Course(s)

Your Message

Upload Example Document(s) (Zip multiple files)

Copyright, G Com Solutions Ltd, 2024.
Tower Bridge Business Centre, 46-48 East Smithfield, London E1W 1AW
0800 998 9248   |   9:00 a.m. till 5:30 p.m.

Connect With Me: