Forum Discussion

Harvey85's avatar
Harvey85
Icon for Helper I rankHelper I
2 years ago
Solved

Filter List of Numeric Values from other Table

Hello, I have the following DAX formula, where I have Table_1 and Table_2 connected by Key_Campaign. I need to add column "save_date" from Table_2 to Table_1, filtering in Table_2 the following:  ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, Harvey85 

    Based on your description, I have created the following sample data:

    Table_1:

    Table_2:

    Labor_Table:

    The relationship between the tables is as follows:

    I'm using the following DAX to filter the rows with Valid = Yes:

    End_Date =
    VAR _mediumtable =
        SUMMARIZE (
            FILTER ( 'Labor_Table', 'Labor_Table'[Valid] = "Yes" ),
            'Labor_Table'[Labor_Id],
            'Labor_Table'[Labor],
            'Labor_Table'[Valid]
        )
    RETURN
        MAXX (
            FILTER (
                'Table_2',
                'Table_1'[Key_Campaign] = 'Table_2'[Key_Campaign]
                    && CONTAINSSTRING ( 'Table_2'[catstock], "SEA." )
                    && 'Table_2'[Labor_Id] = [Labor_Id]
            ),
            'Table_2'[save_date]
        )
    

    In the variables, I use FILTER to filter out the rows with Valid=Yes. And use the summarize function to summarize, the main purpose is to get the corresponding row name so that this column can be used in MAXX.
    The DAX execution result is as follows:

    I've provided the PBIX file for this time below, and it would be great if it would help you.

     

     

     

     

    How to Get Your Question Answered Quickly

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.