Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

summarize with multiple filter

Good evening everyone!

 

I havent been able to solve a DAX sintax. I need to create a table with some columns from a bigger table. However, I need to bring data by two conditions. 

 

The first is condition is to bring all data that says "yes" in the signed off column. And the second condition is to bring the last value updated when encountered the same client twice for the same country (my example 2 times for colombia)

 

 

 

 

I´ve been using this code but its not working. What am I doing wrong? I would appreciate any feedbak. Thanks in advance. 

 

TPCC Clients = CALCULATETABLE(sumamrize(FILTER('Share Point',max('Share Point'[Created]) && CONTAINSSTRING('Share Point'[Signed Off], "yes")),'Share Point'[Region],'Share Point'[Delivery Countries],'Share Point'[Client Holding Name],'Share Point'[Created])
  • You are not comparing the max of the Created column with anything, so to convert the max date to a boolean expression it will be treating 0 as false and non-zero as true, so all your rows will match that condition. You could use a variable to capture the max value and then compare it to the created value for the current row.

     

    eg

     

    TPCC Clients =
    SUMMARIZE (
        FILTER (
            'Share Point',
            VAR maxCreated =
                MAX ( 'Share Point'[Created] )
            RETURN
                'Share Point'[Created] = maxCreated
                    && CONTAINSSTRING ( 'Share Point'[Signed Off], "yes" )
        ),
        'Share Point'[Region],
        'Share Point'[Delivery Countries],
        'Share Point'[Client Holding Name],
        'Share Point'[Created]
    )

1 Reply

  • You are not comparing the max of the Created column with anything, so to convert the max date to a boolean expression it will be treating 0 as false and non-zero as true, so all your rows will match that condition. You could use a variable to capture the max value and then compare it to the created value for the current row.

     

    eg

     

    TPCC Clients =
    SUMMARIZE (
        FILTER (
            'Share Point',
            VAR maxCreated =
                MAX ( 'Share Point'[Created] )
            RETURN
                'Share Point'[Created] = maxCreated
                    && CONTAINSSTRING ( 'Share Point'[Signed Off], "yes" )
        ),
        'Share Point'[Region],
        'Share Point'[Delivery Countries],
        'Share Point'[Client Holding Name],
        'Share Point'[Created]
    )