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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Anonymous
Not applicable

True/False column after evaluating a set of rows

Hi Everyone,

 

I need to create a Column in DAX to create the Bold Column in below Table. It would evaluate if each row# has a True Match in "Match?" Column, then new column will be True, otherwise False

 

Row#AttributeValueBaseValueCompareMatch?All Values in same Row# Match?
11AATrueFalse
12ABFalseFalse
13BBTrueFalse
21AATrueTrue
31BBTrueFalse
32CAFalseFalse
41AATrueTrue
42AATrueTrue
43CCTrueTrue
44BBTrueTrue

 

Thanks

1 ACCEPTED SOLUTION

@Anonymous like this?

 

Result Column = 
VAR _row = 'Table (2)'[RowNumber]
VAR _test_for_true = 'Table (2)'[Is Predecessor Plan inside External Dependencies]
VAR _values = 
    CALCULATE(
        DISTINCTCOUNT('Table (2)'[Is Predecessor Plan inside External Dependencies]),
        'Table (2)'[RowNumber] = _row,
        REMOVEFILTERS('Table (2)')
    )
VAR _result = 
    IF(_values = 1 && _test_for_true,  TRUE(), FALSE() )
RETURN
    _result

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

View solution in original post

8 REPLIES 8
SpartaBI
Community Champion
Community Champion

@Anonymous 
solution file: True False column after evaluating a set of rows 2022-08-03.pbix

Write this calculated column:

 

Result Column = 
VAR _row = 'Table'[Row#]
VAR _values = 
    CALCULATE(
        DISTINCTCOUNT('Table'[Match?]),
        'Table'[Row#] = _row,
        REMOVEFILTERS('Table')
    )
VAR _result = 
    IF(_values = 1,  TRUE(), FALSE() )
RETURN
    _result

 

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Anonymous
Not applicable

Hi @SpartaBI ,

 

Thanks for your support on this. When I try your solution in my sample file/data I posted earlier it works perfectly. However, when I try this in my dataset (which it has the same structure/logic than the sample) for some reason is not giving the same output. Ive attached a portion of the dataset with both the sample data and this one with the solution.

SamplePBIX 

Which could be the issue? When I read the logic behind your column I see that the output should be correct for my dataset as it is in the sample data.

Thanks,

@Anonymous if all columns for row number are false, you want to get false?
Cause that's not what I did but I will add this logic if that is what you meant.

Anonymous
Not applicable

Hi Sparta,

The outcomes should be:

If all Row# are False, then False
If some Row# are False and others are True, then False
If all Row# are True, then True


@Anonymous like this?

 

Result Column = 
VAR _row = 'Table (2)'[RowNumber]
VAR _test_for_true = 'Table (2)'[Is Predecessor Plan inside External Dependencies]
VAR _values = 
    CALCULATE(
        DISTINCTCOUNT('Table (2)'[Is Predecessor Plan inside External Dependencies]),
        'Table (2)'[RowNumber] = _row,
        REMOVEFILTERS('Table (2)')
    )
VAR _result = 
    IF(_values = 1 && _test_for_true,  TRUE(), FALSE() )
RETURN
    _result

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Anonymous
Not applicable

The test for true was the key! Ty!

my pleasure 🙂
P.S. Kudos are always welcome 😀 
Check out my showcase report - got some high level stuff there. Sure you will find there a lot of cool ideas. Please give it a thumbs up over there if you liked it 🙂
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543

Hi Sparta,
Can you please breakdown how - _test_for_true

is working? 

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors