Forum Discussion

Harry_Tran's avatar
Harry_Tran
Helper III
3 years ago
Solved

Convert DAX to M

Hi everyone,

I have a column like this:

A = COUNTX

                  ( FILTER 

                             ('Date', 'Date'[Date] >= 'Sales'[StartDate] && 'Date'[Date] <= 'Sales'[EndDate] and 'Date'[Filter] = 1)

                  , 'Date'[Date] )

 

How can I recarete this column in Power Query

Thanks

  • Hi, Harry_Tran

     

    I assume you have this calculated column on the 'Date'-table.

    Depending on the amount of data in 'Sales' you can create the column in power query by adding a custom column to 'Date', and just write Sales. Then expand the table, and create a calculated column which returns 1 if date is between start and end, and Filter=1. The use groupby with count, and you should have it.

     

    Cheers,
    Sturla

    If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

     

     

1 Reply

  • sturlaws's avatar
    sturlaws
    Resident Rockstar

    Hi, Harry_Tran

     

    I assume you have this calculated column on the 'Date'-table.

    Depending on the amount of data in 'Sales' you can create the column in power query by adding a custom column to 'Date', and just write Sales. Then expand the table, and create a calculated column which returns 1 if date is between start and end, and Filter=1. The use groupby with count, and you should have it.

     

    Cheers,
    Sturla

    If this post helps, then please consider Accepting it as the solution. Kudos are nice too.