Forum Discussion

gtamir's avatar
gtamir
Post Patron
6 years ago
Solved

Create new filtered table

Hi. I want to create a new table from Sales table containing all the names from Table 2, but to filter Sales between date1 and date2.  For exmple between 1/8/2019 and 31/10/2019 (in Sales).

Thanks, Giora

 

  • Hi gtamir ,

     

    Kindly remind you that the communicate forum is a public web, if your data such as name and phone number is real, you’d better delete the picture and using the fake sample data.

     

    We can create a table using DAX like following to filter what you want. Please remember that tables are computed during the database processing and then stored in the model. So the date to filter cannot be dynamic.

     

    Table3 =
    VAR startDate =
        DATE ( 2019, 8, 1 )
    VAR endDate =
        DATE ( 2019, 10, 31 )
    RETURN
        FILTER (
            ALL ( Sales ),
            Sales[Date] >= startDate
                && [Date] <= endDate
                && CONTAINS ( 'SMS Sent', 'SMS Sent'[Name], Sales[Name] )
        )
    

     

2 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi gtamir ,

     

    Kindly remind you that the communicate forum is a public web, if your data such as name and phone number is real, you’d better delete the picture and using the fake sample data.

     

    We can create a table using DAX like following to filter what you want. Please remember that tables are computed during the database processing and then stored in the model. So the date to filter cannot be dynamic.

     

    Table3 =
    VAR startDate =
        DATE ( 2019, 8, 1 )
    VAR endDate =
        DATE ( 2019, 10, 31 )
    RETURN
        FILTER (
            ALL ( Sales ),
            Sales[Date] >= startDate
                && [Date] <= endDate
                && CONTAINS ( 'SMS Sent', 'SMS Sent'[Name], Sales[Name] )
        )
    

     

    • gtamir's avatar
      gtamir
      Post Patron

      Thanks a lot, it works perfectly.

      Of course, the names are not real, they are taken from Adventure Works. 

      Giora