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