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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Need to check Parent or Not

Hi team,

 

I need to create a calculate column, to check wheather it is parent or not based on "Sno =0"

 

if sno =0 with respective Parent Id then "Yes" else "No"

Siva554_0-1630941922768.png

 

 

Thanks in Advance,

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can try this column expression.

 

HasParent =
IF (
    CALCULATE (
        COUNTROWS ( Table ),
        ALLEXCEPT ( Table, Table[ParentID] ),
        Table[Sno] = 0
    ) > 0,
    "Yes",
    "No"
)

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

You can try this column expression.

 

HasParent =
IF (
    CALCULATE (
        COUNTROWS ( Table ),
        ALLEXCEPT ( Table, Table[ParentID] ),
        Table[Sno] = 0
    ) > 0,
    "Yes",
    "No"
)

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Greg_Deckler
Super User
Super User

@Anonymous Column = IF([Sno]=0,"Yes","No")   ?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

NO.

1.Consider with Parent ID , Sno =0, then it is parent.

2. If Sno<>0 then it is not parent.

 

Siva554_0-1630948990865.png

 



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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