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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
luisbaleeiro
New Member

How to assess a row based in two dates from another table?

Hi, guys

 

I would like to assess a date (table1) based in two diferent dates from another table (table2). It must be done for each raw from table2. 

If at leats returns one true situation, returns 1. If not, returns 0.

Example: jose has one result as 1, because there is at least one raw in a table2 where the date is between the date1 and the date2. In this case, 5-jan is gratter than 1-jan anda smaller than 15-jan

 

table1  table2 
nomedataresult nomedata1data2
jose5-jan1 jose1-jan15-jan
jose20-jan0 jose1-jan15-jan
maria5-jan1 jose1-feb15-feb
maria20-jan0 maria1-jan15-jan
 total2 maria1-jan15-jan
    maria1-feb15-feb
2 ACCEPTED SOLUTIONS
powerbiexpert22
Impactful Individual
Impactful Individual

Hi @luisbaleeiro ,

please follow below steps , attached is sample report

step1: add index column in both table

step2: create calculated column as shown below 

powerbiexpert22_0-1726446425629.png

https://drive.google.com/file/d/1A5fy8I-2neLfSALj_f87q63HTVe3PJMY/view?usp=drive_link

 

View solution in original post

Anonymous
Not applicable

Hi @luisbaleeiro 

 

Thank you very much powerbiexpert22 and SachinNandanwar for your prompt reply.

 

For your question, here is the method I provided:

 

Create a new column.

 

Result = 
IF (
    COUNTROWS (
        FILTER (
            'Table 2',
            'Table 2'[nome] = 'Table 1'[nome] &&
            'Table 1'[data] >= 'Table 2'[data1] &&
            'Table 1'[data] <= 'Table 2'[data2]
        )
    ) > 0,
    1,
    0
)

 

Here is the result.

 

vnuocmsft_0-1726561784030.png

 

Regards,

Nono Chen

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

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @luisbaleeiro 

 

Thank you very much powerbiexpert22 and SachinNandanwar for your prompt reply.

 

For your question, here is the method I provided:

 

Create a new column.

 

Result = 
IF (
    COUNTROWS (
        FILTER (
            'Table 2',
            'Table 2'[nome] = 'Table 1'[nome] &&
            'Table 1'[data] >= 'Table 2'[data1] &&
            'Table 1'[data] <= 'Table 2'[data2]
        )
    ) > 0,
    1,
    0
)

 

Here is the result.

 

vnuocmsft_0-1726561784030.png

 

Regards,

Nono Chen

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

 

powerbiexpert22
Impactful Individual
Impactful Individual

Hi @luisbaleeiro ,

please follow below steps , attached is sample report

step1: add index column in both table

step2: create calculated column as shown below 

powerbiexpert22_0-1726446425629.png

https://drive.google.com/file/d/1A5fy8I-2neLfSALj_f87q63HTVe3PJMY/view?usp=drive_link

 

SachinNandanwar
Super User
Super User

Can you please format the sample data that you posted in a more readable manner ?



Regards,
Sachin
Check out my Blog

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.