Forum Discussion

SLR_PBI's avatar
SLR_PBI
Regular Visitor
6 years ago

SQL to DAX Help

Hey Friends,

Can you please help me to convert below sql to DAX .

 

 

SELECT COUNT(B.Parent_SID) Parent_Count,  FullName FROM [BI].[Fact_OutboundCalls] A INNER JOIN [BI].[Dim_Parent] B ON A.DialedNumber = B.PHONE

       INNER JOIN [BI].[Dim_Employee] C ON A.Employee_SID = C.Employee_SID

    GROUP BY   C.FullName

1 Reply

  • Considering you have below relationships in your Power BI data model

     

    B[Phone] = A[DialedNumber]
    C[Employee_SID] = A[EmployeeSID]

     

    you can use below to create table using DAX

    SUMMARIZECOLUMNS(c[FullName],"Parent_Count", Count(b[Parent_SID]))
     
    *if you have many to many relationship, i would suggest to create a table with Unique values to join both tables and create star schema structure.
    let me know if it helps.
     
    Thank You,
    Sandeep