Forum Discussion

amikm's avatar
amikm
Icon for Helper V rankHelper V
4 years ago
Solved

issue with Selectcolumns and filter in DAX

I am trying to solve the below business logic using DAX: I need a list of customer that has all Nyka bags in last 18 mos All orders in last 18 mos. The date of last Nyka order Who is the Sales r...
  • v-jingzhang's avatar
    4 years ago

    Hi amikm 

     

    You can use the following code to create a filtered table. 

    Table 2 =
    SELECTCOLUMNS (
        FILTER (
            Sales,
            Sales[Vendor_Name] = "NYKA"
                && Sales[ORDER_DATE] > EDATE ( MAX ( Sales[ORDER_DATE] ), -18 )
        ),
        "CUSTOMER NO", Sales[CUSTOMER_NO],
        "Venodor Name", Sales[Vendor_Name],
        "Order Date", Sales[ORDER_DATE],
        "SALES REP", Sales[SALES_REP_ID],
        "ORDER STATUS", Sales[ORDER_STATUS]
    )
    

     

    You can use EDATE to get the date that is the indicated number of months before or after the start date.

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.