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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
jay_patel
Helper IV
Helper IV

Need Column which should lies between from date and to date

Hii experts 

 

I have Two tables (A And B) both having key which is used to establish relation among them. and Table A having invoice date as shown below

 

TABLE A
Invoice date key
03-03-20211
04-02-20212

 

And Table B having From date and Two date as shown below

 

TABLE B
Customer NameFrom DateTo Datekey
ABC 01-01-202112-01-20211
SDF 02-01-202122-01-20212
CFR 03--2-202131-03-20213

 

I need Customer Name from Table B to Table A using key for those where Invoice Date lies between From date & To Date "

[FromDate] <= _Date,_Date <= [To Date]
 
Please suggest dax for the same.
 
 
Thanks in advance

"

1 ACCEPTED SOLUTION
sktneer
Resolver I
Resolver I

How about this?

 

Customer Name =
VAR BetweenDates =
    'Table A'[Invoice Date]
        >= RELATED ( 'Table B'[From Date] )
        && 'Table A'[Invoice Date]
            <= RELATED ( 'Table B'[To Date] )
RETURN
    IF (
        BetweenDates,
        RELATED ( 'Table B'[Customer Name] )
    )

View solution in original post

1 REPLY 1
sktneer
Resolver I
Resolver I

How about this?

 

Customer Name =
VAR BetweenDates =
    'Table A'[Invoice Date]
        >= RELATED ( 'Table B'[From Date] )
        && 'Table A'[Invoice Date]
            <= RELATED ( 'Table B'[To Date] )
RETURN
    IF (
        BetweenDates,
        RELATED ( 'Table B'[Customer Name] )
    )

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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