ISLOGICAL

ISLOGICAL

How to Use the Power BI DAX function ISLOGICAL

In this article, we will discuss in detail how to use the Power BI DAX function ISLOGICAL.

Syntax of the ISLOGICAL Function

The ISLOGICAL function takes one argument, which can be any value. The syntax for the ISLOGICAL function is as follows:


ISLOGICAL(value)


The value argument is the value that you want to test for being a logical value. It can be a column reference, a scalar value, or an expression.

Examples of Using ISLOGICAL Function

Let's look at some examples of using the ISLOGICAL function in Power BI.

Example 1: Testing If a Value is a Logical Value

Suppose we have a table named 'Sales' that contains a column named 'IsPromoted'. The 'IsPromoted' column contains values TRUE and FALSE, which indicate whether a sale was promoted or not.

To test if the values in the 'IsPromoted' column are logical values, we can use the following DAX formula:


=ISLOGICAL(Sales[IsPromoted])


This formula will return TRUE if the values in the 'IsPromoted' column are logical values, otherwise, it will return FALSE.

Example 2: Using ISLOGICAL Function in Combination with Other Functions

Suppose we want to calculate the total number of promoted sales in the 'Sales' table. We can use the following DAX formula to achieve this:


=COUNTIF(Sales[IsPromoted],TRUE)


The COUNTIF function counts the number of cells that meet a certain condition. In this case, we are counting the cells in the 'IsPromoted' column that contain the value TRUE.

However, before using the COUNTIF function, we need to make sure that the values in the 'IsPromoted' column are logical values. We can do this by using the ISLOGICAL function in combination with the IF function.

The following DAX formula will convert the values in the 'IsPromoted' column to logical values:


=IF(ISLOGICAL(Sales[IsPromoted]),Sales[IsPromoted],FALSE)


This formula will return the values in the 'IsPromoted' column if they are already logical values. Otherwise, it will return the value FALSE.

We can now use the COUNTIF function with the modified 'IsPromoted' column to calculate the total number of promoted sales.

In conclusion, the ISLOGICAL function in Power BI is a useful function for testing whether a value is a logical value or not. It is commonly used in combination with other DAX functions to perform complex calculations. By using the examples and syntax discussed in this article, you can start using the ISLOGICAL function in your Power BI reports and dashboards.

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: