PERMUT

How to Use the Power BI DAX function PERMUT

What is the PERMUT Function?

The PERMUT function in DAX calculates the number of permutations for a given set of items. A permutation is a way to arrange a set of items in a particular order. For example, if you have three items {A, B, C}, there are six possible permutations: ABC, ACB, BAC, BCA, CAB, and CBA. The PERMUT function returns the total number of permutations for a given set of items.

How to Use the PERMUT Function

The syntax for the PERMUT function is:


PERMUT(number, number_chosen)


where `number` is the total number of items in the set, and `number_chosen` is the number of items to choose in each permutation.

For example, if you have a set of 5 items and want to know how many ways you can arrange them in groups of 2, you would use the PERMUT function like this:


PERMUT(5, 2)


which would return the value 20. This means there are 20 possible ways to arrange the 5 items in groups of 2.

Examples

Let’s look at some examples of using the PERMUT function in Power BI.

Example 1

Suppose you have a table with a list of products, and you want to know how many ways you can order them. The table might look something like this:


Product

-------

A

B

C

D


To calculate the number of permutations for this set of items, you would create a new measure using the PERMUT function:


Product Permutations = PERMUT(COUNTROWS(Products), COUNTROWS(Products))


This measure uses the COUNTROWS function to calculate the total number of products, which is passed as the first argument to the PERMUT function. The second argument is also the total number of products, since we want to know how many ways we can arrange all of the items.

Example 2

Suppose you have a table with a list of cities, and you want to know how many ways you can select 3 cities from the list. The table might look something like this:


City

----

New York

London

Paris

Tokyo


To calculate the number of permutations for this set of items, you would create a new measure using the PERMUT function:


City Permutations = PERMUT(COUNTROWS(Cities), 3)


This measure uses the COUNTROWS function to calculate the total number of cities, which is passed as the first argument to the PERMUT function. The second argument is the number of cities we want to choose for each permutation, which is 3 in this case.

The PERMUT function in DAX is a useful tool for calculating the number of permutations for a given set of items. By following the syntax and examples provided in this article, you can start using the PERMUT function in Power BI to gain insights into your data.

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)