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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Hide rows of unique column value if another column has both values needed

 

I have a table with two columns - "SKU" and "Parentorchild". 

 

If a SKU is a "Parent" (highlighted in yellow), I want to hide all instances where the SKU is also a "child" (highlighted in red). 

 

I do not want to hide any instances where the SKU is only a child but not a parent. Only when the SKU is both a child and parent, should the child rows be hidden. Is there a calculated column or measure that can help with this? 

 

vinayda_1-1680643955957.png

 

5 REPLIES 5
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://1drv.ms/u/s!AiUZ0Ws7G26RhwF59nThEKCkWRn0?e=3NTtfA
Screen Capture #816.png

Anonymous
Not applicable

This solution partially works. There are cases when a duplicate SKU is child. Then both duplicate rows where Parentorchild = Child are removed. Can you modify this code to account for this duplication?

Is this what you are looking for?
Screen Capture #838.png

show an example so that I can understand and help you

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

It is for creating a new column.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1680665232373.png

 

Expected result CC =
VAR _conditionP =
    COUNTROWS (
        FILTER ( Data, Data[SKU] = EARLIER ( Data[SKU] ) && Data[Parentorchild] = "P" )
    )
VAR _conditionC =
    COUNTROWS (
        FILTER ( Data, Data[SKU] = EARLIER ( Data[SKU] ) && Data[Parentorchild] = "C" )
    )
RETURN
    IF (
        _conditionP = 1
            && _conditionC = 1,
        IF ( Data[Parentorchild] = "P", Data[Parentorchild], BLANK () ),
        Data[Parentorchild]
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.