FIXED
A
C
- CALCULATE
- CALCULATETABLE
- CALENDAR
- CALENDARAUTO
- CEILING
- CHISQ.DIST
- CHISQ.DIST.RT
- CHISQ.INV
- CHISQ.INV.RT
- CLOSINGBALANCEMONTH
- CLOSINGBALANCEQUARTER
- CLOSINGBALANCEYEAR
- COALESCE
- COLUMNSTATISTICS
- COMBIN
- COMBINA
- COMBINEVALUES
- CONCATENATE
- CONCATENATEX
- CONFIDENCE.NORM
- CONFIDENCE.T
- CONTAINS
- CONTAINSROW
- CONTAINSSTRING
- CONTAINSSTRINGEXACT
- CONVERT
- COS
- COSH
- COT
- COTH
- COUNT
- COUNTA
- COUNTAX
- COUNTBLANK
- COUNTROWS
- COUNTX
- COUPDAYBS
- COUPDAYS
- COUPDAYSNC
- COUPNCD
- COUPNUM
- COUPPCD
- CROSSFILTER
- CROSSJOIN
- CUMIPMT
- CUMPRINC
- CURRENCY
- CURRENTGROUP
- CUSTOMDATA
D
E
I
N
O
P
R
S
- SAMEPERIODLASTYEAR
- SAMPLE
- SEARCH
- SECOND
- SELECTCOLUMNS
- SELECTEDMEASURE
- SELECTEDMEASUREFORMATSTRING
- SELECTEDMEASURENAME
- SELECTEDVALUE
- SIGN
- SIN
- SINH
- SLN
- SQRT
- SQRTPI
- STARTOFMONTH
- STARTOFQUARTER
- STARTOFYEAR
- STDEVX.P
- STDEVX.S
- STDEV.P
- STDEV.S
- SUBSTITUTE
- SUBSTITUTEWITHINDEX
- SUM
- SUMMARIZE
- SUMMARIZECOLUMNS
- SUMX
- SWITCH
- SYD
T
U
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.