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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Two Conditions for IF formula

Hello,

 

I am trying to identify contacts that have multiple roles where one role type = Professor and one role type = Student. I have included some pictures of my sample data and relationships below.

 

Link to sample data:

 

https://www.dropbox.com/s/1tgcuxrn2rtso6x/test.xlsx?dl=0

 

1.png

2.png3.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I think this needs to be a calculated column because I need row by row data not aggregate but I am not sure how to link multiple rows of related data in a formula. Below is what I have tried so far.

 

Column = 
    VAR RoleType = Role[Role Type]
    Return  
       IF(
            RoleType = "Professor" && RoleType = "Student", 
            "True", 
            "False"
    )

I've also created a measure that counts roles and works at the contact level

 

Role Count = 
    CALCULATE(
        COUNTROWS(Role))

Any help is greatly appreciated!

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

I'm sure there are lots of ways to do this. If you want a table ..

Table  = INTERSECT( 
    SUMMARIZECOLUMNS 
     ( 'Role Data'[Contact.Full Name] , 
     FILTER('Role Data', 'Role Data'[Role Type] = "Professor")),
 SUMMARIZECOLUMNS 
     ( 'Role Data'[Contact.Full Name] , 
     FILTER('Role Data',  'Role Data'[Role Type] =  "Student")))

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

I'm sure there are lots of ways to do this. If you want a table ..

Table  = INTERSECT( 
    SUMMARIZECOLUMNS 
     ( 'Role Data'[Contact.Full Name] , 
     FILTER('Role Data', 'Role Data'[Role Type] = "Professor")),
 SUMMARIZECOLUMNS 
     ( 'Role Data'[Contact.Full Name] , 
     FILTER('Role Data',  'Role Data'[Role Type] =  "Student")))
Anonymous
Not applicable

Thanks @HotChilli ! Just tried this out and it works like a charm. I was also able to create two measures to count the roles per contact that worked when I displayed it data in a visual table. 

 

Professor Role Count = 
   CALCULATE(
        COUNTX(Role, Role[Tole Type]), 
            FILTER(Role, Role[Tole Type] = "Professor"))

Student Role Count = 
    CALCULATE(
        COUNTX(Role, Role[Tole Type]), 
            FILTER(Role, Role[Tole Type] = "Student"))

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 MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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