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
MarcinSV
Helper I
Helper I

How to change this SQL into DAX

Hi,
In SQL I have

SELECT DMS_DATABASE_ID

, MIN(DATE_INSERT) AS DATE_INSERT

, VERSION_DMS

FROM AP_SVA_SOURCE_REPORT_DATA_EXT

WHERE DMS_DATABASE_ID IS NOT NULL

GROUP BY DMS_DATABASE_ID

, VERSION_DMS

ORDER BY DATE_INSERT

What is the correct formula in DAX, I'd like to add new table with DAX formula instead of doing new query  and download data from SQL...

1 ACCEPTED SOLUTION

@MarcinSV  Please create a new table as below

 

NewTableName = SUMMARIZE(FILTER(DATAEXT,DMS_DATABASE_ID <> "NULL"),DMS_DATABASE_ID,VERSION_DMS,"DATE_INSERT",MIN(DATE_INSERT))

Note - If you have NULL values stored as text then you need to consider them as string while comparing as we did above.





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi MarcinSV,

 

Just want to ensure that what is the source? If it is not SQL, then what?

 

It's all straight forward to have the columns and apply filter on top of the dataset.

 

Regards,

Pradeep

Every columns are in one table DATAEXT -> this is the source in PBI


@Anonymous wrote:

Hi MarcinSV,

 

Just want to ensure that what is the source? If it is not SQL, then what?

 

It's all straight forward to have the columns and apply filter on top of the dataset.

 

Regards,

Pradeep


 

I mean that I don't want to use another SQL Query in Get Date because I have analitycal table (DATAEXT) imported from SQL to PBI and I'd like to add new table directly in PBI Desktop using DAX formula. That's why I wondering how to write correct formula in DAX which will do the same as SQL but based on source in PBI - table DATAEXT. Name of columns are the same.

@MarcinSV  Please create a new table as below

 

NewTableName = SUMMARIZE(FILTER(DATAEXT,DMS_DATABASE_ID <> "NULL"),DMS_DATABASE_ID,VERSION_DMS,"DATE_INSERT",MIN(DATE_INSERT))

Note - If you have NULL values stored as text then you need to consider them as string while comparing as we did above.





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Thank you, works perfectly! 

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.