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
Tuna123
Frequent Visitor

Combining two tables and filtering based on combined rows

I have two tables:

Date table		Data table			
Date		Product	Type	Start	End
1/2018		A	1	1/2019	1/2020
2/2018		A	2	1/2019	1/2021
3/2018		A	3	1/2020	1/2050
4/2018		B	1	1/2021	1/2022
5/2018		B	2	1/2022	1/2021
6/2018		B	3	1/2023	1/2021
7/2018		C	1	1/2018	1/2022
8/2018		C	2	1/2018	1/2022
9/2018		C	3	1/2021	1/2050
…		…	…	…	…

I'm trying to crossjoin the dates with product data  (product and type) into one table but I only need the date-product combinations when the product is "active" (between the start and end dates). Is there a way to do this?

 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @Tuna123

 

This shall do it hopefully.

 

Add a new Table from Modelling Tab  as follows

CombinedTable =
GENERATE (
    'DataTable',
    FILTER (
        DateTable,
        DateTable[Date] >= 'DataTable'[Start]
            && DateTable[Date] <= 'DataTable'[End]
    )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

Hi @Tuna123

 

This shall do it hopefully.

 

Add a new Table from Modelling Tab  as follows

CombinedTable =
GENERATE (
    'DataTable',
    FILTER (
        DateTable,
        DateTable[Date] >= 'DataTable'[Start]
            && DateTable[Date] <= 'DataTable'[End]
    )
)

Regards
Zubair

Please try my custom visuals

Thanks @Zubair_Muhammad

 

This worked nicely.

 

PBIX file based on your sample attached here

 


Regards
Zubair

Please try my custom visuals

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.