cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jpbi Frequent Visitor
Frequent Visitor

True/False DAX query

I have 3 three tables (see image at bottom of question) which represent a list of students belonging to a developer community, the universities they attend and if they have a PHD or not (0 if yes, 1 if no).

 

What I want to do is produce a report that has a list of universities and TRUE or FALSE depending on whether they have any PHD students or not. So, in this example snippet, the output report would be two universities - "Zurich" - "TRUE", "Edinburgh" "FALSE".

 

What query could I use to generate the values for this PHD true/false column? The issue i'm having is I don't know how to write such a query to cover 3 tables. Help would be much appreciated.

 

snip.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
judspud Member
Member

Re: True/False DAX query

Hi @jpbi 

 

As long as your tables are all connected properly the mesaure should span across them with no problems.

 

Im assuming your tables follow the relationships below

Universities to StudentUniversities on the University column

StudentUniversities to Students on the Student column

 

If so, then a measure as below should work:

 

 if(sum(Students[phd])>0,True(),False)

 

Place into a table the name column from the Universities table and the measure and you should have the result you requested Smiley Happy

 

Hope this helps

 

Thanks,

George

5 REPLIES 5
judspud Member
Member

Re: True/False DAX query

Hi @jpbi 

 

As long as your tables are all connected properly the mesaure should span across them with no problems.

 

Im assuming your tables follow the relationships below

Universities to StudentUniversities on the University column

StudentUniversities to Students on the Student column

 

If so, then a measure as below should work:

 

 if(sum(Students[phd])>0,True(),False)

 

Place into a table the name column from the Universities table and the measure and you should have the result you requested Smiley Happy

 

Hope this helps

 

Thanks,

George

Super User
Super User

Re: True/False DAX query

@jpbi few question before post the solution:

 

in student univesity table, does each student can be only in one university or multiple university?

 

in student table, I assume each student is a unique row.






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

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





jpbi Frequent Visitor
Frequent Visitor

Re: True/False DAX query


@parry2k wrote:

@jpbifew question before post the solution:

 

in student univesity table, does each student can be only in one university or multiple university?

 

in student table, I assume each student is a unique row.


 

A student can only be part of one university.

 

And yes correct, each student is unique row 

Super User
Super User

Re: True/False DAX query

@jpbi solution proposed by @judspud will work.






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

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





jpbi Frequent Visitor
Frequent Visitor

Re: True/False DAX query

Thanks for your help @judspud @parry2k 

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Users Online
Currently online: 270 members 2,753 guests
Please welcome our newest community members: