MOD

How to Use the Power BI DAX function MOD

Syntax of the MOD Function

Before diving into how to use the MOD function in Power BI DAX, it is important to understand the syntax of the function. The MOD function takes two arguments:


MOD(❰numerator❱, ❰denominator❱)


Here, the numerator is the number that you want to divide, and the denominator is the number you want to divide by.

How to Use the MOD Function in Power BI DAX

To better understand how to use the MOD function in Power BI DAX, let's take a look at an example. Suppose we have a table containing a list of numbers, and we want to create a new column that returns the remainder when each number is divided by 3. Here's how we can do it:

1. First, we need to open a new query in Power BI Desktop and connect to the data source containing the table.

2. Next, we need to create a new column in the table by clicking on "New Column" under the "Modeling" tab in the ribbon.

3. In the formula bar, we need to enter the following formula:


MOD(❰ColumnName❱, 3)


Here, `❰ColumnName❱` is the name of the column containing the list of numbers. This formula will return the remainder when each number in the column is divided by 3.

4. Finally, we need to give a name to the new column by typing it in the "Column name" field at the top of the formula bar.

5. Once we click on "OK", the new column will be added to the table, and we can use it in our analysis.

Additional Tips for Using the MOD Function

Here are some additional tips for using the MOD function in Power BI DAX:

- The MOD function can also be used with negative numbers. In this case, the result will also be negative.

- If the denominator is 0, the MOD function will return a #NUM! error.

- The MOD function can be combined with other functions in Power BI DAX to create more complex calculations.

The MOD function in Power BI DAX is a very useful tool for data analysis and calculations. By following the steps outlined in this article, you can easily use the MOD function to return the remainder after dividing one number by another. Remember to follow the syntax of the function and avoid dividing by zero to get accurate results.

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)