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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PhilippeJosse
New Member

Calculate new date based on columns in two tables

Dear Forum members, 

unfortunately i was unable to find a matching solution, so thought i would go ahead and post the challange i am confronted with and hoping to find support.

--->

I have a Table A with 36.000 rows, and it grows about 300 rows a month. 

 

IDDateCategoryTarget Date

1

01.02.2024HV..
202.01.2024STD..
302.01.2024HV..

*dd.MM.yyyy

 

And Table B, which is a "calendar" table.

 

DateYearQuarterMonthWeekWeekdayIndicator 1Indicator 2

01.01.2024

2024

Q101-Jan11YesYes
02.01.20242024Q101-Jan12YesNo
03.01.20242024Q101-Jan13NoNo

*dd.MM.yyyy

 

Would like to accomplish to calculate a new value in column Target Date in Table A for each individual row.

Where the starting value is the value Column Date for respective row.

Next, If column Category = HV then Date+2 (days) else Date+1 (day)

 

now, using the calculated date as reference, I would like to find the next (or first date higher than the calculated) date in column Date of Table B where a column Indicator 1= "yes" and Indicator 2 = "no".

 

Appriciate any guidance!

 

Thank 

Philippe

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @PhilippeJosse - Hope in your tables Date columns is date type

 

create a calculated column in first table, as below:

 

InitialTargetDate =
IF (
    TABA1[Category] = "HV",
    TABA1[Date] + 2,
    TABA1[Date] + 1
)

 

rajendraongole1_1-1721726873487.png

 

 

another calclated column:

TargetDate =
VAR InitialDate =
    IF (
        TABA1[Category] = "HV",
        TABA1[Date] + 2,
        TABA1[Date] + 1
    )
RETURN
    CALCULATE (
        MIN (TABA2[Date]),
        FILTER (
            TABA2,
            TABA2[Date] > InitialDate &&
            TABA2[Indicator 1] = "Yes" &&
            TABA2[Indicator 2] = "No"
        )
    )

 

rajendraongole1_0-1721726818807.png

 

Hope it helps

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @PhilippeJosse - Hope in your tables Date columns is date type

 

create a calculated column in first table, as below:

 

InitialTargetDate =
IF (
    TABA1[Category] = "HV",
    TABA1[Date] + 2,
    TABA1[Date] + 1
)

 

rajendraongole1_1-1721726873487.png

 

 

another calclated column:

TargetDate =
VAR InitialDate =
    IF (
        TABA1[Category] = "HV",
        TABA1[Date] + 2,
        TABA1[Date] + 1
    )
RETURN
    CALCULATE (
        MIN (TABA2[Date]),
        FILTER (
            TABA2,
            TABA2[Date] > InitialDate &&
            TABA2[Indicator 1] = "Yes" &&
            TABA2[Indicator 2] = "No"
        )
    )

 

rajendraongole1_0-1721726818807.png

 

Hope it helps

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors