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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
psilos24
Helper I
Helper I

SQL to DAX conversion

Hello Experts,

 

I am facing issue while converting below SQL query into DAX. Can you please help me to convert the query:

 

SELECT
first_name AS 'Name',
last_name AS 'Surname',
IFNULL(l.logged_hours, 0.0) AS 'Logged Hours',
IFNULL(b.billable_hours, 0.0) AS 'Billable Hours',
IFNULL(nb.non_billable_hours, 0.0) AS 'Non-Billable Hours'
FROM
at_user u
LEFT JOIN
(SELECT user_id, sum(actuals) / 60 as logged_hours
FROM tt_record
GROUP BY user_id) AS l ON u.id = l.user_id
LEFT JOIN
(SELECT user_id, sum(actuals) / 60 as billable_hours
FROM
(SELECT
user_id, task_id, actuals, billing_type_id
FROM
actitimedb.tt_record r LEFT JOIN task t ON r.task_id = t.id LEFT JOIN project p ON p.id = t.project_id
WHERE
p.customer_id <> 383) ch
GROUP BY
user_id) AS b ON b.user_id = u.id
LEFT JOIN
(SELECT user_id, sum(actuals) / 60 as non_billable_hours
FROM
(SELECT
user_id, task_id, actuals, billing_type_id
FROM
actitimedb.tt_record r LEFT JOIN task t ON r.task_id = t.id LEFT JOIN project p ON p.id = t.project_id
WHERE
p.customer_id = 383) ch
GROUP BY
user_id) AS nb ON nb.user_id = u.id
WHERE
u.username NOT IN ('.....',
'.....',
'....',
'....',
'....',
'....',
'...',
'.....' )
ORDER BY Surname, Name

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi  @psilos24 ,

 

Please refer to this article.

https://www.sqlbi.com/articles/from-sql-to-dax-projection/

 

Also you can share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hello psilos24,

 

What exactly are you wanting to do here? Create a measure? A summary table? An entire table in your model? I see you're pulling in 5 fields so I'd assume you're wanting this to be a table in your model.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.