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
mvgust
Helper III
Helper III

Set records filter based on specific values

I need to set a True/False column flag when the values in a table match the following:

 

IDs are the same and the Code=PTX

 

So in the below example, I would like a flag column which would indicate true on the highlighted records.

 

code-ptx.png

 

Thank you!

 

 

1 ACCEPTED SOLUTION

Hi @mvgust ,

I can also get the result using my previous formula:

fl.png

Attached my sample file that you can refer, please check and try it: Set records filter based on specific values.pbix

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hi @mvgust ,

You can create a calcualte column like this:

Flag =
VAR _count =
    CALCULATE (
        COUNT ( 'Table'[Id] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Id] = EARLIER ( 'Table'[Id] )
                && 'Table'[Code] = "PTX"
        )
    )
RETURN
    IF ( _count = 1, TRUE (), FALSE () )

Result:

flag.png

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

This is very close to what I need, however I do have the following scenario where the flag isn't catching a record:

 

PTX flag.png

 

Thank you.

Hi @mvgust ,

I can also get the result using my previous formula:

fl.png

Attached my sample file that you can refer, please check and try it: Set records filter based on specific values.pbix

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the 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.