cancel
Showing results for 
Search instead for 
Did you mean: 
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
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors