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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Lookup? IF?

Hi All,

 

i need help to find a right formula.

 

I do have 3 colum: Date ( dates ) - Origin ( Text ) - Destination ( Text ). The goal here is to find old and new lanes. 

 

i am trying to look at ( Origin and Destination column together ) and if these value ( together )  are in column Date ( 2018  ) then is an old lane other wise ( if in 2019 )   is a new lane....

 

i hope this above is clear.

 

thanks 

 

Diego

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create a measure as below.

Measure = 
VAR countr =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', YEAR ( 'Table'[date] ) = 2018 )
    )
RETURN
    IF ( ISBLANK ( countr ), "new lane", "old lane" )

Or we can crreate a calculated column to work on it.

Column = 
VAR countr =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[origin], 'Table'[destination] ),
            YEAR ( 'Table'[date] ) = 2018
        )
    )
RETURN
    IF ( countr = BLANK (), "new lane", "old lane" )

Capture.PNG

 

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

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create a measure as below.

Measure = 
VAR countr =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', YEAR ( 'Table'[date] ) = 2018 )
    )
RETURN
    IF ( ISBLANK ( countr ), "new lane", "old lane" )

Or we can crreate a calculated column to work on it.

Column = 
VAR countr =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[origin], 'Table'[destination] ),
            YEAR ( 'Table'[date] ) = 2018
        )
    )
RETURN
    IF ( countr = BLANK (), "new lane", "old lane" )

Capture.PNG

 

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

Can you provide a sample of your data and the expected result? Hard to write a formula to help when you are trying to compare two text columns to a date column with no context for what the text actually is.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors