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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to compare two filtered query

Hi everyone, I'm new in the community.

I need some help, I have to compare two query, in particular I filter each query by the same value and then I have to compare every row of the table 1 with every row in the table 2. 

In the screen there is the two tables filtered by the same value "CODLAV". I have to find the maximum value of data in "INVIO" in the first tabel that is between "DATAINSERIMENTO" and "Datasuccessiva" in the second table. I trie using FIRSTNONBLANK command but there are some errors. Thak you for the help!

 

Table 1Table 1

Check.png

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
If we consider Table2 is the table that contains the column "INVIO", the you can ceate a new calculated column in Table1 ( The table that contains the "DATAINSERIMENTO" and "Datasuccessiva" columns) using the following code:

INVIO =
MAXX (
    FILTER (
        Table2,
        Table2[INVIO] >= EARLIER ( Table1[DATAINSERIMENTO] )
            && Table2[INVIO] <= EARLIER ( Table1[Datasuccessiva] )
    ),
    Table2[INVIO]
)

 

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Anonymous 
If we consider Table2 is the table that contains the column "INVIO", the you can ceate a new calculated column in Table1 ( The table that contains the "DATAINSERIMENTO" and "Datasuccessiva" columns) using the following code:

INVIO =
MAXX (
    FILTER (
        Table2,
        Table2[INVIO] >= EARLIER ( Table1[DATAINSERIMENTO] )
            && Table2[INVIO] <= EARLIER ( Table1[Datasuccessiva] )
    ),
    Table2[INVIO]
)

 

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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