Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I am new to Power BI and DAX. I need assistance converting (learning how to convert) a SQL statement to DAX. The statement below is useful extracting against SSMS, but we have a Semantic Model which pulls in all of the identified tables - and DAX is needed to create the report in PowerBI.
Any guidance would be helpful. Thank you.
Select W.Wrk + '-' + RIGHT(WS.Sample,2) as SampleID,
WS.SampleName,
WS.Sampled,
CONVERT(VARCHAR(12), SA.nResult) AS ReportedResult,
SA.Analyte,
CONVERT(VARCHAR(12),
SA.Result) AS InitialResult,
WS.SampledBy,
Case
When ws.sampledby = 'adam aleon'
Then 'AL'
Else sec.initials
End As Initials,
SA.Initials as ReviewedBy,
se.Status
From WRK as W
Inner Join WRKSAMPLE as WS On W.Wrk = WS.Wrk
Inner Join SAMPLEANALYSIS as SA On WS.Sample = SA.Sample And
WS.Wrk = SA.Wrk
Left Join SECURITY as Sec On Sec.Fullname = WS.SampledBy
left join sampleextraction as se on se.wrk = sa.wrk and se.sample = sa.sample and se.analysis = sa.analysis
Where W.ProjectNumber = 'p01072' and WS.Sampled >
--First day of last month
DATEADD(m,DATEDIFF(m,0,GETDATE())-1,0)
And WS.Sampled <
--First day of this month
DATEADD(ms,-2,DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0))
And SA.Initials <> ''
And SA.IsQC = 0
And WS.SampleName Like 'S%'
And WS.SampleName Not Like '%A%'
And WS.SampleName Not Like '%B%'
And WS.SampleName Not Like 'SPV%'
And SE.status <> 'cancelled'
ORDER BY WS.Wrk, WS.Sample, SA.Analyte
Solved! Go to Solution.
Thats great but unforutanetly at the first sight the SQL query looks to complicated to be converted to DAX .There are 4 tables involved with multiple joins with to many predicates.If its me I would stick to SQL View approach.
But if you still would like to try the DAX way, then post the semantic model,the business rules and the sample data here.
Thank you. I was hoping to learn how this would translate to DAX - so that I can begin to understand the language and be able to code for myself in the future.
selectdax.in
Thats great but unforutanetly at the first sight the SQL query looks to complicated to be converted to DAX .There are 4 tables involved with multiple joins with to many predicates.If its me I would stick to SQL View approach.
But if you still would like to try the DAX way, then post the semantic model,the business rules and the sample data here.
Why not just create a SQL view of the above statement and feed that as an input to your semantic model ?
I am very new to this - so I'm not sure what that would look like (adding a view to the semantic model).
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 5 |
| User | Count |
|---|---|
| 24 | |
| 11 | |
| 9 | |
| 9 | |
| 8 |