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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors