Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
streamly
Regular Visitor

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!

1 ACCEPTED SOLUTION

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" )

Capture.PNG

 

Pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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

Hi,

My solution should still work.  If it does not, then please share that instance.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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" )

Capture.PNG

 

Pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.