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
JohmRA
Regular Visitor

If a value exists in two columns, mark with "Yes"

Hello, 

 

I have the table below

JohmRA_0-1725895074755.png

I am using slicer based on "Main Item Number" 

what I am trying to achieve, when I filter for example by "11", the following tables to be shown. 

JohmRA_2-1725895235559.png

not only "QQQ" but also the "QQC" and "QQD" as they are part of "QQQ" 

 

also to add a new col, if the item number exists in "Assembly item" to be marked with "Yes"

 

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JohmRA 

For your question, here is the method I provided:

 

Here's some dummy data

 

“Table”

vjialongymsft_0-1725953410500.png

 

 

You need to create a new disconnected table to act as a slicer.

 

Table 2 = SUMMARIZE('Table','Table'[Main item number])

 

“Table 2”

vjialongymsft_1-1725953410502.png

 

Create a new column.

 

Mark =

VAR _select_rownumber = 'Table'[Row number]

VAR _current_assembly_item = 'Table'[Assembly item]

VAR _next_assembly_item = CALCULATE(SELECTEDVALUE('Table'[Assembly item]),FILTER(ALL('Table'),'Table'[Row number] = _select_rownumber +1))

RETURN

IF(

   _current_assembly_item > 0 || _next_assembly_item > 0,

   "Yes",

   BLANK()

)

 

vjialongymsft_2-1725953658742.png

 

 

Create a  measure.

 

Measure =

VAR _select_number = SELECTEDVALUE('Table 2'[Main item number])

RETURN

IF(  

   ISFILTERED('Table 2'[Main item number]),

       IF(

           SELECTEDVALUE('Table'[Main item number])=_select_number || SELECTEDVALUE('Table'[Assembly item]) = _select_number,

           SELECTEDVALUE('Table'[Main item name]),

           BLANK()

       ),

   SELECTEDVALUE('Table'[Main item name])

)

 

Here is the result.

vjialongymsft_5-1725953826264.png

 

 

vjialongymsft_4-1725953814695.png

 

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @JohmRA 

For your question, here is the method I provided:

 

Here's some dummy data

 

“Table”

vjialongymsft_0-1725953410500.png

 

 

You need to create a new disconnected table to act as a slicer.

 

Table 2 = SUMMARIZE('Table','Table'[Main item number])

 

“Table 2”

vjialongymsft_1-1725953410502.png

 

Create a new column.

 

Mark =

VAR _select_rownumber = 'Table'[Row number]

VAR _current_assembly_item = 'Table'[Assembly item]

VAR _next_assembly_item = CALCULATE(SELECTEDVALUE('Table'[Assembly item]),FILTER(ALL('Table'),'Table'[Row number] = _select_rownumber +1))

RETURN

IF(

   _current_assembly_item > 0 || _next_assembly_item > 0,

   "Yes",

   BLANK()

)

 

vjialongymsft_2-1725953658742.png

 

 

Create a  measure.

 

Measure =

VAR _select_number = SELECTEDVALUE('Table 2'[Main item number])

RETURN

IF(  

   ISFILTERED('Table 2'[Main item number]),

       IF(

           SELECTEDVALUE('Table'[Main item number])=_select_number || SELECTEDVALUE('Table'[Assembly item]) = _select_number,

           SELECTEDVALUE('Table'[Main item name]),

           BLANK()

       ),

   SELECTEDVALUE('Table'[Main item name])

)

 

Here is the result.

vjialongymsft_5-1725953826264.png

 

 

vjialongymsft_4-1725953814695.png

 

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

 

 

 

Selva-Salimi
Super User
Super User

@JohmRA 

 

One of the easiest way is to create a calculated column as follows and then use this column as your slicer:

 

calculatedColumn:= if ([assembly item]=0, [main item number] , [assembly item] )

 

If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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