ISODD

ISODD

How to Use the Power BI DAX function ISODD

In this article, we will explore how to use the ISODD function in Power BI. We will begin by discussing what the function does and how it works, then we will provide examples of how to use it in practice.

Understanding the ISODD Function

The ISODD function is a logical function that returns TRUE if a given number is odd, and FALSE if it is even. Here is the syntax for the function:


ISODD(number)


The "number" argument is the value that you want to test for oddness. This can be a number, a reference to a cell containing a number, or a formula that returns a number.

The ISODD function works by dividing the number by 2 and checking whether the remainder is 1. If the remainder is 1, the number is odd and the function returns TRUE. If the remainder is 0, the number is even and the function returns FALSE.

Using the ISODD Function in Practice

Now that we understand how the ISODD function works, let's take a look at some examples of how to use it in practice.

Example 1: Filtering Odd Numbers

Suppose we have a table of sales data, and we want to filter the data to show only the sales that occurred on odd-numbered days. We can use the ISODD function in conjunction with the FILTER function to accomplish this.


FILTER(Sales, ISODD(DAY(Sales[Date])))


In this example, we are filtering the "Sales" table to show only the rows where the day of the date in the "Date" column is odd. The DAY function extracts the day of the date, and the ISODD function tests whether the day is odd.

Example 2: Grouping by Odd and Even Numbers

Suppose we have a table of customer data, and we want to group the customers based on whether their customer ID is odd or even. We can use the ISODD function in conjunction with the GROUPBY function to accomplish this.


GROUPBY(Customers, ISODD(Customers[CustomerID]), “Group”)


In this example, we are grouping the "Customers" table by whether the customer ID is odd or even. The ISODD function tests whether the customer ID is odd, and the GROUPBY function groups the customers based on the result of the test. We are also using the "Group" argument to name the resulting column.

The ISODD function in Power BI is a powerful tool that can be used to filter and group data based on odd or even numbers. By understanding how the function works and how to use it in practice, you can take full advantage of its capabilities in your data analysis and modeling.

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: