Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
miarismendez
Regular Visitor

Comparing 3 columns in the same table for a return result

I have three columns of data that if certain combinations are meet then its true, otherwise false. These are text values and all the examples I have seen are for number values.

 

miarismendez_0-1650918167088.jpeg

 

This is my report and these are the combinations I am trying write a DAX formula.

If the row has any of the following combinations, then the return should be true. It the row does not, then it returns false.

 

Session Category

Sample Type

Sample Method

True/False

Area/Background

Chemical

Area

True

Area/Background

Chemical

Background

True

Area/Background

NORM

Area

True

Area/Background

NORM

Background

True

Area/Background

Area Noise

Area

True

 

 

 

 

Personal

Chemical

Personal

True

Personal

Personal Noise

Personal

True

 

I tried If and switch but nothing seem to work right.

Please help! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @miarismendez ,

 

There should be a table with all True combinations.

RicoZhou_0-1651132482336.png

Create a calculated column in your data table.

True/False = 
VAR _COMBINELIST =
    SELECTCOLUMNS (
        Combinations,
        "Combine",
            COMBINEVALUES (
                "-",
                Combinations[Session Category],
                Combinations[Sample Type],
                Combinations[Sample Method]
            )
    )
VAR _COMBINEVALUE =
    COMBINEVALUES (
        "-",
        'Table'[Session Category],
        'Table'[Sample Type],
        'Table'[Sample Method]
    )
RETURN
    IF ( _COMBINEVALUE IN _COMBINELIST, TRUE (), FALSE () )

Result is as below.

RicoZhou_1-1651132574314.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @miarismendez ,

 

There should be a table with all True combinations.

RicoZhou_0-1651132482336.png

Create a calculated column in your data table.

True/False = 
VAR _COMBINELIST =
    SELECTCOLUMNS (
        Combinations,
        "Combine",
            COMBINEVALUES (
                "-",
                Combinations[Session Category],
                Combinations[Sample Type],
                Combinations[Sample Method]
            )
    )
VAR _COMBINEVALUE =
    COMBINEVALUES (
        "-",
        'Table'[Session Category],
        'Table'[Sample Type],
        'Table'[Sample Method]
    )
RETURN
    IF ( _COMBINEVALUE IN _COMBINELIST, TRUE (), FALSE () )

Result is as below.

RicoZhou_1-1651132574314.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I was able to make it work but I wondered is creating a calculated column the only way? Is there a measure that would do the same thing?

 

Also, is a separate table with the combinations always needed in these types of comparisons?

 

I am just wondering since there seems to be different ways and for some people still learning Power BI I want to make sure we use something they can remember easily.

 

Either way thank you!!!

Calculated columns are preferable when the result is immutable (not influenced by users' filter choices).

Measures are required if the result can be impacted by users'  filter choices.

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. 

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.