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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vmadm
Regular Visitor

search values in a column with conditions from other columns

Hi everyone,

I am starting to use power BI and I have a difficulty.

I have a table similar to this

 

code 1code 2state
1AOpen
2BReviewed
3CReviewed
4DReviewed
5EReviewed
6BClosed
7BOpen
8AReviewed
9CReviewed
10AOpen
11FClosed

 

I need to get the values of code1 or the corresponding rows in which the following conditions are met:
- the state is reviewed
- There is no other row with the same code 2 where the status is different from revised

For the table above, the result should be

 

code 1code 2state
3CReviewed
4DReviewed
5EReviewed
9CReviewed

 

Or

 

Codes 1:  3,4,5,9

 

 

1 ACCEPTED SOLUTION
ibarrau
Super User
Super User

Hi. I don't really get what you need to do but I think this might help. This can be solved with power query too, but you asked in dax forum so I will do it on dax.

You can add a calculated column to flag your codes2 that have a state different from "Reviewed" to let you know about this condition. Like this:

FlagColumn = 
IF (
    Tabla[code 2] IN ( 
        SELECTCOLUMNS(
            FILTER( Tabla; Tabla[state] <> "Reviewed" )
            ; "codi"; Tabla[code 2] 
        )
    );
    TRUE();
    FALSE()
)

With this flag you can just filter the table as you wish:

 

dax column falg to filterdax column falg to filter

This is not the better solution regarding performance, but I don't know what you will do with this.

Hope this helps,

 

Regards,


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

Happy to help!

LaDataWeb Blog

View solution in original post

2 REPLIES 2
ibarrau
Super User
Super User

Hi. I don't really get what you need to do but I think this might help. This can be solved with power query too, but you asked in dax forum so I will do it on dax.

You can add a calculated column to flag your codes2 that have a state different from "Reviewed" to let you know about this condition. Like this:

FlagColumn = 
IF (
    Tabla[code 2] IN ( 
        SELECTCOLUMNS(
            FILTER( Tabla; Tabla[state] <> "Reviewed" )
            ; "codi"; Tabla[code 2] 
        )
    );
    TRUE();
    FALSE()
)

With this flag you can just filter the table as you wish:

 

dax column falg to filterdax column falg to filter

This is not the better solution regarding performance, but I don't know what you will do with this.

Hope this helps,

 

Regards,


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

Happy to help!

LaDataWeb Blog

Thanks,

 

This solved my problem,

 

Regards.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.