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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
tmears
Helper III
Helper III

SQL left Join

Hi everyone

I would if anyone could give me some pointers as struggling a bit.  My SQL query knowledge is not great.  I need to tranlate this into DAX.  and doing my research but goig around in circles a bit!!

 

the SQL query is:

 

select personview.forename, personview.surname,
wlocation.dateanswervalue as "Expiry Date from Last Carer Monitoring",
personOrgRelationshipView.organisationname as "Scheme",

publia.answervalue as "Expiry Date from Pre-Placement Checklist",

personview.personid
from personview

left join formanswerpersonview wlocation
on personview.personid=wlocation.answerforsubjectid
and designguid ='f98ab2f7-7010-4c93-b9de-2801066ccda8'
And controlname='certificateExpiryDate'
and instancestate='COMPLETE'
and wlocation.instanceid= (
select max (x.instanceid)
from formanswerpersonview x
where x.answerforsubjectid = wlocation.answerforsubjectid
and x.designguid = wlocation.designguid
and x.instancestate='COMPLETE'
)

left join formanswerpersonview publia
on personview.personid=publia.answerforsubjectid
and publia.designguid ='3f6d7b80-e1b6-4286-b6a9-803fc569706b'
And publia.controlname='date_21'
and publia.instancestate='COMPLETE'
and publia.instanceid= (
select max (x.instanceid)
from formanswerpersonview x
where x.answerforsubjectid = publia.answerforsubjectid
and x.designguid = publia.designguid
and x.instancestate='COMPLETE'
)
INNER join personOrgRelationshipView
on personview.personid=personOrgRelationshipView.personid

inner join classificationPersonView places
on places.personid=personview.personid
wHERE code='APP'
And status='ACTIVE'
AND endDate IS NULL

order by forename

 

Clearly the inner joins are fine but it is the left join i am unclear on?  any help would be greatly appriciated, as i continue to research

 

Many thanks 

 

Tim 

2 REPLIES 2
v-lionel-msft
Community Support
Community Support

Hi @tmears ,

 

Please provide the sample tables and expected output, I will help you achieve it using DAX.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

it's actually the other way around.  For the sake of your argument Power BI always does a left join by default*, it's the inner join that you need to work for.

 

* What actually happens is much more complex, based on the concept of expanded tables, with a sprinkling of Auto Exist .

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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