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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

IF, AND , COUNT ROWS and RELATEDTABLE Query Help needed

Beginner at PBI

 

Added a column with below query to get Employee Status

 

Status = if(and(COUNTROWS(RELATEDTABLE('Master Data'))>=1,COUNTROWS(RELATEDTABLE('Collated LB'))>=1),COUNTROWS(RELATEDTABLE('Completers Table'))>=1),"Completer", if(and(COUNTROWS(RELATEDTABLE('Master Data'))>=1,COUNTROWS(RELATEDTABLE('Collated LB'))>=1),COUNTROWS(RELATEDTABLE('Completers Table'))>=0),"Enrolled","Yet to Start"))
 
Not Sure why this does not work. 😞
Sangit_0-1627464316398.png

 

Please advice  

 

1 ACCEPTED SOLUTION

@Anonymous 

change and to &&, pls have a try.

 

Status = if(COUNTROWS(RELATEDTABLE('Master Data'))>=1 && COUNTROWS(RELATEDTABLE('Collated LB'))>=1) && COUNTROWS(RELATEDTABLE('Completers Table'))>=1),"Completer", if(COUNTROWS(RELATEDTABLE('Master Data'))>=1 && COUNTROWS(RELATEDTABLE('Collated LB'))>=1) && COUNTROWS(RELATEDTABLE('Completers Table'))>=0),"Enrolled","Yet to Start"))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
Siriwat_Lukin
Helper I
Helper I

Hi @Anonymous,

 

Could you please share example you data and result that you want?

 

Thank you,

ryan_mayu
Super User
Super User

@Anonymous 

AND can only has two conditions. if you have three conditions, it needs to be  and(and(condition1, condition2),condition3)
pls try to use && 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi @ryan_mayu 

 

Can you write it in a query form and show as an example or edit below query

 

Status = if(and(COUNTROWS(RELATEDTABLE('Master Data'))>=1,COUNTROWS(RELATEDTABLE('Collated LB'))>=1),COUNTROWS(RELATEDTABLE('Completers Table'))>=1),"Completer", if(and(COUNTROWS(RELATEDTABLE('Master Data'))>=1,COUNTROWS(RELATEDTABLE('Collated LB'))>=1),COUNTROWS(RELATEDTABLE('Completers Table'))>=0),"Enrolled","Yet to Start"))

@Anonymous 

change and to &&, pls have a try.

 

Status = if(COUNTROWS(RELATEDTABLE('Master Data'))>=1 && COUNTROWS(RELATEDTABLE('Collated LB'))>=1) && COUNTROWS(RELATEDTABLE('Completers Table'))>=1),"Completer", if(COUNTROWS(RELATEDTABLE('Master Data'))>=1 && COUNTROWS(RELATEDTABLE('Collated LB'))>=1) && COUNTROWS(RELATEDTABLE('Completers Table'))>=0),"Enrolled","Yet to Start"))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

WOWW it worked 😃

 

Little change with parenthesis. Below is the updated one

 

Status = if(COUNTROWS(RELATEDTABLE('Master Data'))>=1 && COUNTROWS(RELATEDTABLE('Collated LB'))>=1 && COUNTROWS(RELATEDTABLE('Completers Table'))>=1,"Completer", if(COUNTROWS(RELATEDTABLE('Master Data'))>=1 && COUNTROWS(RELATEDTABLE('Collated LB'))>=1 && COUNTROWS(RELATEDTABLE('Completers Table'))>=0,"Enrolled","Yet to Start"))

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.