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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AGo
Post Patron
Post Patron

Converting DAX to Power Query M language in the query editor

Column = 
CALCULATE (
    MAX ( Table1[date] ),
    FILTER (
        ALL ( Table1 ),
        EARLIER ( Table1[product ID] ) = Table1[product ID]
            && EARLIER ( Table1[date] ) <= Table1[date]
            && EARLIER ( Table1[Index] ) <> Table1[Index]
    )
)

 

Hi,

I have this DAX formula that blows up the server (13GB RAM) on a 400K rows database and I'd like to have it in M language and copy it in the query editor to test if it works faster or being less RAM consuming. Can you please help me?

2 REPLIES 2
Eric_Zhang
Employee
Employee

Capture.PNG@AGo

 

Not an expert on Power Query and doubt it would have much better performance than DAX. As you're using database, if SQL Server, try an equivalent query as below.

 

SELECT *
FROM table1 t1
CROSS APPLY (
	SELECT max([date]) f
	FROM table1 t2
	WHERE t1.[product ID] = t2.[product ID]
		AND t1.[Index] <> t2.[Index]
		AND t1.[date] <= t2.[date]
	) ca
dchager
Regular Visitor

Read www.daxpatterns.com to find a more efficient DAX formula.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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