ORDERBY
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 discuss how to use the ORDERBY function in Power BI, along with some examples to help you understand its functionalities.
Syntax of ORDERBY Function
The syntax for the ORDERBY function is as follows:
ORDERBY(table, columnName1[, sortOrder1], [columnName2[, sortOrder2]], …)
The parameters for this function are as follows:
– **table**: The table that contains the data you want to sort.
– **columnName1**: The name of the column you want to sort by.
– **sortOrder1**: The order in which you want to sort the data in the first column. This parameter is optional and defaults to ascending order if not specified.
– **columnName2**: The name of the second column you want to sort by. This parameter is optional and can be repeated to sort the data by multiple columns.
– **sortOrder2**: The order in which you want to sort the data in the second column. This parameter is also optional and defaults to ascending order if not specified.
Example 1: Sorting Data by a Single Column
Suppose we have a table of sales data that contains the following columns:
– ProductName
– SalesAmount
To sort this data by the SalesAmount column in descending order, we can use the following formula:
ORDERBY(SalesData, SalesAmount, DESC)
This formula sorts the SalesData table by the SalesAmount column in descending order.
Example 2: Sorting Data by Multiple Columns
Suppose we have a table of employee data that contains the following columns:
– EmployeeName
– Department
– Salary
To sort this data first by the Department column in ascending order, and then by the Salary column in descending order, we can use the following formula:
ORDERBY(EmployeeData, Department, ASC, Salary, DESC)
This formula sorts the EmployeeData table by the Department column in ascending order, and then by the Salary column in descending order.
The ORDERBY function in Power BI is a powerful tool that can help you sort data in a specific order. By using this function, you can easily sort data by one or more columns and display it in a meaningful way. Use the examples provided in this article to understand how to use this function in your own projects.