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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Check if one or more rows has a value of true and mark all records as true

Hi,

 

I'm trying to put in a measure to work out if a record has been checked.

I have the attached data, with an orderid, and then a duplicates key (some customers can have more than one order delivered by the same driver)

I have a list of order_ids that have been checked externally, and put in a list. If the order_id is in the list, it comes up as IsDuplicate = true. 

What I am trying to do is put in the "Has been checked" column (in red). If one of the records with the same key has "isduplicate" = true then all the records with that key should be marked as true.

I am using the following measure:

DuplicatesCheck = CONTAINS(FILTER(Data,Data[DuplicatesKey]=SELECTEDVALUE(Data[DuplicatesKey])),Data[IsDuplicate],TRUE())

but I get the same value as the isDuplicate Column. 

 

I referred to this thread, which got me some of the way there:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Boolean-Aggregate-Functions/td-p/1364240

 

I'm sure I'm close, but I just can't get there.

 

order_idDuplicatesKeyIsDuplicateHas Been Checked
956687684s4/1/2021___TRUEFALSEFALSE
974646346s4/1/2021___TRUEFALSEFALSE
913576467s4/1/2021___TRUEFALSEFALSE
187704359n4/1/2021_Driver1_Cust-A_TRUEFALSETRUE
195733809n4/1/2021_Driver1_Cust-A_TRUETRUETRUE
115093281q4/1/2021_Driver2_Cust-B_TRUETRUETRUE
161218806q4/1/2021_Driver2_Cust-B_TRUEFALSETRUE
157854642v4/1/2021_Driver3_Cust-C_TRUETRUETRUE
161272024v4/1/2021_Driver3_Cust-C_TRUETRUETRUE
170455160v4/1/2021_Driver3_Cust-C_TRUEFALSETRUE
106823034n4/1/2021_Driver4_Cust-D_TRUEFALSEFALSE
143195051n4/1/2021_Driver4_Cust-D_TRUEFALSEFALSE
101293113n4/1/2021_Driver5_Cust-E_TRUEFALSETRUE
167289758n4/1/2021_Driver5_Cust-E_TRUETRUETRUE

 

 

Thanks!

Dave

1 ACCEPTED SOLUTION
edhans
Super User
Super User

Try this @Anonymous 

 

Has Been Checked =
CALCULATE (
    CONTAINS ( Data, Data[IsDuplicate], TRUE () ),
    ALLEXCEPT ( Data, Data[DuplicatesKey] )
)

 

I just removed all filters from the table except for the DuplicatesKey. The [Has Been Checked orig] is your text values in the desired goal above.

My measure is the far right column in red.

edhans_0-1621390982619.png

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
edhans
Super User
Super User

Try this @Anonymous 

 

Has Been Checked =
CALCULATE (
    CONTAINS ( Data, Data[IsDuplicate], TRUE () ),
    ALLEXCEPT ( Data, Data[DuplicatesKey] )
)

 

I just removed all filters from the table except for the DuplicatesKey. The [Has Been Checked orig] is your text values in the desired goal above.

My measure is the far right column in red.

edhans_0-1621390982619.png

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Thanks @edhans - I had tried something similar and it didn't work - this works perfectly!

Excellent. Glad I was able to assist @Anonymous 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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