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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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