Forum Discussion

streamly's avatar
streamly
Regular Visitor
6 years ago
Solved

Compare 2 Table columns based on filter applied

Hi Everyone!

 

I have 2 Tables that i want to compare the 2 columns based on the filter/slicer applied.

 

Table 1:

DateNameEmailTask
01/25/2020AEmail ATask 1
01/25/2020AEmail ATask 2
01/26/2020CEmail CTask 3
01/25/2020BEmail BTask 4
01/25/2020BEmail BTask 5
01/26/2020CEmail CTask 6

 

Table 2:

NameEmail
AEmail A
BEmail B
CEmail C

 

I have Date slicer and want to check if Name in Table 2 has entry Table 1 based on the Date slicer

 

Applied Date slicer/filter: 01/26/2020 in Table 1

Expected Result:

NameEmailwith Task (Y/N)
AEmail AN
BEmail BN
CEmail CY

 

If this is not possible, is there any way to get the same result. Thanks!

  • Hi streamly ,

     

    A sample for your reference.

    Measure = 
    VAR se =
        SELECTEDVALUE ( 'date'[Date] )
    VAR yms =
        YEAR ( se ) * 100
            + WEEKNUM ( se )
    VAR ymc =
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                'Table',
                YEAR ( 'Table'[Date] ) * 100
                    + WEEKNUM ( 'Table'[Date] ) = yms
            )
        )
    RETURN
        IF ( ymc = BLANK (), "N", "Y" )
    

     

    Pbix as attached.

     

4 Replies

    • streamly's avatar
      streamly
      Regular Visitor

      Hi Ashish,

       

      Thanks for the reply. I've missed that Table 1 Dates are Week End Date it should look like this.

       

      Table 1:   
      DateNameEmailTask
      01/03/2020AEmail ATask 1
      01/10/2020AEmail ATask 2
      01/17/2020CEmail CTask 3
      01/10/2020BEmail BTask 4
      01/17/2020BEmail BTask 5
      01/03/2020CEmail CTask 6
      • v-frfei-msft's avatar
        v-frfei-msft
        Community Support

        Hi streamly ,

         

        A sample for your reference.

        Measure = 
        VAR se =
            SELECTEDVALUE ( 'date'[Date] )
        VAR yms =
            YEAR ( se ) * 100
                + WEEKNUM ( se )
        VAR ymc =
            CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER (
                    'Table',
                    YEAR ( 'Table'[Date] ) * 100
                        + WEEKNUM ( 'Table'[Date] ) = yms
                )
            )
        RETURN
            IF ( ymc = BLANK (), "N", "Y" )
        

         

        Pbix as attached.