Forum Discussion

MarcinSV's avatar
MarcinSV
Helper I
7 years ago
Solved

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...

  • 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.

5 Replies

  • Anonymous's avatar
    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

    • MarcinSV's avatar
      MarcinSV
      Helper I

      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


       

      • MarcinSV's avatar
        MarcinSV
        Helper I

        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.