cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jay_patel
Helper III
Helper III

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] )
    )

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.