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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

DAX conversion to Power Query

Hi Guys,

 

Newbie here,

 

Is it possible to convert bellow DAX query into Power Query syntax?

 

_AgentSegmentId =
CALCULATE(
VALUES('Survey Extract'[UCID])
,TOPN(
1
,CALCULATETABLE(
'Survey Extract'
,'Survey Extract'[UCID] = EARLIER(Append1[UCID])
,'Survey Extract'[Agent Call Segment Start Time]<= EARLIER(Append1[Survey Date])
)
,'Survey Extract'[Agent Call Segment Start Time]
,DESC
)
)
 
Thank you!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

It is possible to do this on the query edit side, but it should more complex than DAX formulas. (M query not suitable to do value compare and calculations)

Can you please share some dummy data to test? It is hard to coding formula without any sample data.

How to Get Your Question Answered Quickly 
Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous,

It is possible to do this on the query edit side, but it should more complex than DAX formulas. (M query not suitable to do value compare and calculations)

Can you please share some dummy data to test? It is hard to coding formula without any sample data.

How to Get Your Question Answered Quickly 
Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Hi @Anonymous ,

 

I guess you're right. I've just decided not to convert this into Power Query as it is working on DAX side.

 

Thank you anyways. Appreciate your help.

Together with @amitchandak  and @parry2k .

amitchandak
Super User
Super User

@Anonymous , refer if this can help

https://community.powerbi.com/t5/Quick-Measures-Gallery/Top-1-per-category/td-p/225700

https://www.youtube.com/watch?v=u0kg0xIbJuw

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
parry2k
Super User
Super User

@Anonymous well, if you can share sample data and what you are trying to achieve, it might help to see what is the best way to do it in PQ rather decoding the DAX. Although why you want it in PQ?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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