Dax Function: TRUE

Category: Logical Functions 

The TRUE function in Power BI is a simple DAX function that returns the logical value TRUE. It is typically used to construct conditional expressions or evaluate logical comparisons.

Purpose

  • Serves as a constant for logical evaluations in DAX expressions.
  • Used in combination with other logical and conditional functions for creating filters or conditions.

Type of Calculations

  • Boolean logic-based calculations.
  • Acts as a constant or evaluates conditions for further logical operations.

Practical Use Cases

  • Simplifying conditional logic.
  • Setting up default logical values in DAX expressions.
  • Combining with other logical operators like AND, OR, or IF.
				
					TRUE()
				
			

Parameters

The TRUE function does not take any parameters. Its purpose is solely to return the logical value TRUE.

How Does TRUE Dax Function Works?

The TRUE function acts as a logical constant that represents a boolean TRUE. It is often used in conditional statements to simplify logical expressions or to serve as a placeholder for conditions.

Logical Principle

In DAX, the logical constant TRUE is equivalent to 1 when used in numerical contexts. It is primarily used to evaluate or compare conditions.

What Does It Return?

The function returns the boolean value TRUE.

When Should We Use It?

  • Default Logical Conditions: As a default value in logical comparisons.
  • Simplify Filters: When constructing complex filters, TRUE() can serve as a base condition.
  • Combine with SWITCH: To create range-based logic by always returning TRUE and specifying conditions in the SWITCH function.
  • Placeholder for Debugging: Can be used in testing logical expressions by temporarily replacing conditions.

Examples

Basic Usage

Return a constant value of TRUE:

				
					IsActive = TRUE()
				
			

Column Usage:

Create a conditional column to check if a sales target is exceeded:

				
					Target Met = IF(Sales[Revenue] > Sales[Target], TRUE(), FALSE())
				
			

Advanced Usage

Combine with the SWITCH function to create range-based logic:

				
					Performance Category = SWITCH(TRUE(),
    Sales[Revenue] > 100000, "Excellent",
    Sales[Revenue] > 50000, "Good",
    Sales[Revenue] > 20000, "Average",
    "Poor"
)
				
			

Explanation: TRUE() allows the SWITCH function to evaluate each condition sequentially.

Tips and Tricks

  • Simplify Logical Expressions: Use TRUE() as a default boolean in complex expressions instead of hardcoding logical values.
  • Combine with AND/OR: Enhance conditional checks by combining TRUE() with logical operators.
  • Testing Filters: Use TRUE() in slicers or measures to test filter logic.

Performance Impact of TRUE DAX Function:

  • Minimal Overhead: As a constant, TRUE() has negligible impact on performance.
  • Efficient in Filters: When used in logical conditions, it contributes to fast evaluation of expressions.

Related Functions You Might Need

  • FALSE: Returns the logical constant FALSE.
  • IF: For conditional logic based on TRUE or FALSE results.
  • AND: Logical AND operator for combining multiple conditions.
  • OR: Logical OR operator for combining multiple conditions.

Want to Learn More?
For more information, check out the official Microsoft documentation for TRUE. You can also experiment with this function in your Power BI reports to explore its capabilities.

Unlock the full capabilities of Power BI and elevate your data insights with our specialized consulting services. Whether you need guidance on advanced DAX functions like those highlighted here, support in designing interactive dashboards, or expertise in optimizing data models for enhanced performance, our experienced Power BI consultants are equipped to deliver customized solutions for your business. Explore our Power BI Consulting Services page to discover how we can help your organization make smarter, data-driven decisions.

1. What does the TRUE function do in Power BI?

The TRUE function returns the boolean value TRUE, commonly used in logical expressions and conditions.

2. Can TRUE be combined with other logical functions?

Yes, the TRUE function can be combined with IF, SWITCH, AND, OR, and other logical operators.

3. Is there any difference between TRUE and the boolean constant TRUE in Power BI?

No, the TRUE function and the boolean constant TRUE behave identically in DAX.

4. How is the TRUE function used in filters?

In filters, TRUE() can be used as a condition to evaluate or activate specific logical branches.

5. Can TRUE be used in numerical contexts?

Yes, in numerical contexts, TRUE is treated as 1.

Established in 2020, Lets Viz Technologies provides a full range of high-quality data analysis and data visualization services. We are also an authorized Zoho Partner.

 

Contact

WeWork Berger Delhi One, C-001/A2, Sector 16B, Noida, Uttar Pradesh 201301

0124-502-5592
info@lets-viz.com

We are Social

Trust Pilot Reviews