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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
yjk3140
Helper I
Helper I

Convert SQL query into DAX query

Hi,

I've posted a question in StackOver flow regareding how to convert SQL qery into DAX

Convert SQL query into DAX query for PowerBI visual - Stack Overflow

The answer I've recieved somewhat solved my query but doesn't meet my requirement 100%.

I need to dense rank the job id by timestamp in descending order and find the # of paused jobs.

Please see my comment under the response..

Would really appreciate any help!

2 REPLIES 2
yjk3140
Helper I
Helper I

Hi @amitchandak 

I applied this query but didn't get the correct result...

I wanna convert the sql query below into DAX, how can I correct the dax query you wrote?

SELECT count(job_id) FROM (SELECT distinct job_id,status,DENSE_RANK over() partition by job_id order by timestamp desc AS rn FROM table1) t2 WHERE t2.rn = 1 and where t2.status = "PAUSED"

 

thanks for ur help 🙂

amitchandak
Super User
Super User

@yjk3140 , Check if this can help

Rankx(Allselected('Table'[Timestamp]) , CALCULATE( DISTINCTCOUNT('Table'[job_id]), 'Table'[status] = "PAUSED") ,,desc,dense)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.