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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

DAX

Hi,

 

I want to convert this SQL query into dax for one of my calculations. I used Leftouterjoin but brings blank value. How to write the same logic in DAX.

 

Query:

select count(*) from "CB_ODS_BA_TEST"."GTM"."FRESHSALES_DEALS_ACTIVE" deal left outer join "CB_ODS_BA_TEST"."GTM"."FRESHSALES_LEADS_ACTIVE" lead on deal.deal_id=lead.deal_id where lead.deal_id is null

 

Reg,

Dhana

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Please go to Model Panel (Left hand ribbon) to do the joining among tables as coded in SQL, And then use the below DAX formula to  count rows.

 

SQL_To_DAX =
CALCULATE ( COUNTROWS ( 'Table' ), lead.deal_id = null )

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.

 

Regards,

Gaurav Raj Singh

LinkedIN : https://www.linkedin.com/in/gauravrajsingh/

JustJan
Responsive Resident
Responsive Resident

Hi @Anonymous ,

 

Can't you sort of invert the where statement to "show me all Deals except if there is a Lead"?

 

Then you can use a measure like this": COUNTROWS(EXCEPT( 'Deal', 'Lead'))

 

Jan 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors