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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
user35131
Helper III
Helper III

I want to assign a flag if a group meets the criteria 3 times.

Currently my code works if it meets one of the 3 choices at least once.  If the group (Identifier) has at least "Row1","Row2","Row3" at least once it will be flagged. The adjustment I want to make is if the group has "Row1","Row2", and "Row3" filled.

Flag = 
VAR Flag1 = 
CALCULATE(
    COUNTROWS('Identifier Table'),
    FILTER('Identifier Table','Identifier Table'[Identifier]=EARLIER('Identifier Table'[Identifier]) && 'Identifier'[Identifier] IN { "Row1","Row2","Row3"}
    )
)
RETURN
IF(Flag1 >0 , "Flag", "No Flag")

 

 

Currently 

 

IDCol1Flag
1Row2Yes
1Row2Yes
1Row1Yes
2Row3Yes
2Row2Yes
2Row1Yes
3Row1Yes
4Row4No

 

I want the table to look like this 

 

 

IDCol1Flag
1Row2No
1Row2No
1Row1No
2Row3Yes
2Row2Yes
2Row1Yes
3Row1No
4Row4No
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @user35131,

I'd like to suggest you add values function to remove duplicate values from the table at first, then you can use this list to get the unique item count of specific items to return flag:

NewFlag =
VAR _list =
    CALCULATETABLE (
        VALUES ( 'Table'[Col1] ),
        FILTER (
            ALL ( 'Table' ),
            [ID] = EARLIER ( 'Table'[ID] )
                && [Col1] IN { "Row1", "Row2", "Row3" }
        )
    )
RETURN
    IF ( COUNTROWS ( _list ) = 3, "Yes", "No" )

1.PNG

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @user35131,

I'd like to suggest you add values function to remove duplicate values from the table at first, then you can use this list to get the unique item count of specific items to return flag:

NewFlag =
VAR _list =
    CALCULATETABLE (
        VALUES ( 'Table'[Col1] ),
        FILTER (
            ALL ( 'Table' ),
            [ID] = EARLIER ( 'Table'[ID] )
                && [Col1] IN { "Row1", "Row2", "Row3" }
        )
    )
RETURN
    IF ( COUNTROWS ( _list ) = 3, "Yes", "No" )

1.PNG

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.