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
prasadhebbar315
Advocate I
Advocate I

Summarize data based on conditions

Hello,

I need help in creating a Result column from the below table based on the condition that both Col1 and Col2 should atleast contain Yes for a Serial_Number. If yes, then the entire Serial_Number should have Yes in Result column.

Serial Number 200 and 400 contains "Yes" atleast once in both Col1 and Col2 , therefore it has "Yes" in Result.

 

Serial_NumberCol1Col2Result
100YesNoNo
100NoNoNo
100NoYesNo
200YesYesYes
200NoNoYes
300NoYesNo
300YesNoNo
300NoNoNo
400NoNoYes
400YesNoYes
400YesYesYes
2 ACCEPTED SOLUTIONS
wdx223_Daniel
Super User
Super User

Result=IF(COUNTROWS(FILTER(Table,Table[Serial_Number]=EARLIER(Table[Serial_Number])&&Table[Col1]="Yes"&&Table[Col2]="Yes"))>0,"Yes","NO")

View solution in original post

prasadhebbar315
Advocate I
Advocate I

@wdx223_Daniel Thanks a ton. Your solution has worked.

View solution in original post

4 REPLIES 4
prasadhebbar315
Advocate I
Advocate I

@wdx223_Daniel Thanks a ton. Your solution has worked.

MohTawfik
Resolver I
Resolver I

@prasadhebbar315 

If you want to create this calculation in the table, go to data view, click on new column and type the below formula:

Result =
 IF( 'Table'[Col1] = "Yes" || 'Table'[Col2] = "Yes",
 "Yes",
 "No")

If you want to do this in the report as a measure, go to report view and add new measure as follow:
Result measure =

Var COl1Value =
SELECTEDVALUE('Table'[Col1])

Var Col2value =
SELECTEDVALUE('Table'[Col2])

Return

 IF( COl1Value = "Yes" || Col2value = "Yes",
 "Yes",
 "No")

@MohTawfik Thanks for providing the solution

wdx223_Daniel
Super User
Super User

Result=IF(COUNTROWS(FILTER(Table,Table[Serial_Number]=EARLIER(Table[Serial_Number])&&Table[Col1]="Yes"&&Table[Col2]="Yes"))>0,"Yes","NO")

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.