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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors