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! Learn more

Reply
SneffeL
Regular Visitor

Marrying 3 Tables with Multiple Values and Different Dates

SneffeL_0-1712647146135.png

Hi, I have been racking my brains for awhile but can't seem to figure out the proper way to go about doing this.

 

I am trying to figure out how to reference both Table 2 and Table 3 to Table 1.

 

Using Customer A as an example, the objectives are:

 

1) Determine whether Customer A is a VIP during the point of visit; and

2) Determine what Customer A's card limit is at the point of visit

 

In this case, Customer A's VIP status should have lasted from 1/1/2023 to 2/23/2024 and his card limit would be 100 from 1/1/2023 to 2/22/2024 and increased to 200 from 2/23/2024 onwards.

 

Much appreciated if anyone can provide me with some directions, thank you very much. 

1 ACCEPTED SOLUTION
Bmejia
Super User
Super User

This is based on what I understand, I feel that both T2 and T3 will need additional logic as they either renewal their VIP or there credit limit changes through different periods, but this might get you started.

I am assuming you already joined all the tables on Customer if not do so most likely they be join many to many and both.

Step 1, On Table 3 create a new column and add something like this.  This will give you the last date from the last time the VIP Status was changed (Note that in the return statement I used date 1/1/2050 as the default end date if it the date is blank)

Next Aval Date =

VAR CurrentDate = T3[VIP DATE]

VAR CurrentCustomer = T3[CUSTOMER]

VAR NEXTAVAIL =

CALCULATE (

    MIN ( T3[VIP DATE] ),

    FILTER (

        T3,

        T3[CUSTOMER] = CurrentCustomer

        && T3[VIP DATE] > CurrentDate

    )

)

RETURN

IF(NEXTAVAIL=BLANK(),DATE(2050,1,1),NEXTAVAIL)

 

It should look something like this:

Bmejia_0-1712696853415.png

 

 

Step 2 go to T1 and create a new column this will identify if the range is within the VIP Date and New Aval Date (new column) and add the VIP Status

VIP STATUS =

CALCULATE (

    VALUES ( T3[VIP STATUS]),

    FILTER (

        'T3',

        'T1'[VISIT DATE] >=  T3[VIP DATE]  

            && T1[VISIT DATE] <= T3[Next Aval Date]

    )

)


It should look something like this:

Bmejia_1-1712696933838.png

 



Step 3 you would do the same thing as step 1 but on table 2 data

Bmejia_2-1712697002283.png

 

 

Step 4 you would do the same thing as step 2 only difference is that on “ && T1[VISIT DATE] <=  T2[Next Aval Date]” want to remove the equal sign like this “ && T1[VISIT DATE] < T2[Next Aval Date]” Cause it might create an error if you don’t cause is looking at two similar numeric values.

Bmejia_3-1712697044875.png


Then you just use a matrix table and drag the information from T1 to view if customer had VIP Status and what was the card limit during the period.

Bmejia_4-1712697092396.png


I hope this get you started.

View solution in original post

2 REPLIES 2
audreygerred
Super User
Super User

Hello! You are going to want to model this as a star schema. Here is an article I wrote about it: http://powerbiwithme.com/2023/07/30/the-star-schema-edition/

 

You will want to have a customer dimension table where each customer is listed only once. This will join to Tables A, B, and C.

 

You will want a date dimension table that is also joined to tables A, B, and C. Here is an article I wrote about Date dim tables and the one I love from SQLBI: http://powerbiwithme.com/2023/08/01/the-custom-date-table-edition/

 

Once you have these set up you'll be able to make what you need through visuals and measures.





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

Proud to be a Super User!





Bmejia
Super User
Super User

This is based on what I understand, I feel that both T2 and T3 will need additional logic as they either renewal their VIP or there credit limit changes through different periods, but this might get you started.

I am assuming you already joined all the tables on Customer if not do so most likely they be join many to many and both.

Step 1, On Table 3 create a new column and add something like this.  This will give you the last date from the last time the VIP Status was changed (Note that in the return statement I used date 1/1/2050 as the default end date if it the date is blank)

Next Aval Date =

VAR CurrentDate = T3[VIP DATE]

VAR CurrentCustomer = T3[CUSTOMER]

VAR NEXTAVAIL =

CALCULATE (

    MIN ( T3[VIP DATE] ),

    FILTER (

        T3,

        T3[CUSTOMER] = CurrentCustomer

        && T3[VIP DATE] > CurrentDate

    )

)

RETURN

IF(NEXTAVAIL=BLANK(),DATE(2050,1,1),NEXTAVAIL)

 

It should look something like this:

Bmejia_0-1712696853415.png

 

 

Step 2 go to T1 and create a new column this will identify if the range is within the VIP Date and New Aval Date (new column) and add the VIP Status

VIP STATUS =

CALCULATE (

    VALUES ( T3[VIP STATUS]),

    FILTER (

        'T3',

        'T1'[VISIT DATE] >=  T3[VIP DATE]  

            && T1[VISIT DATE] <= T3[Next Aval Date]

    )

)


It should look something like this:

Bmejia_1-1712696933838.png

 



Step 3 you would do the same thing as step 1 but on table 2 data

Bmejia_2-1712697002283.png

 

 

Step 4 you would do the same thing as step 2 only difference is that on “ && T1[VISIT DATE] <=  T2[Next Aval Date]” want to remove the equal sign like this “ && T1[VISIT DATE] < T2[Next Aval Date]” Cause it might create an error if you don’t cause is looking at two similar numeric values.

Bmejia_3-1712697044875.png


Then you just use a matrix table and drag the information from T1 to view if customer had VIP Status and what was the card limit during the period.

Bmejia_4-1712697092396.png


I hope this get you started.

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