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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
javieezy
Helper I
Helper I

Help - date range lookup between queries

Dear all, 

 

I have 2 tables in 2 queries: 

 

-1: Period table: 

javieezy_0-1663172848235.png

-2: Data table: 

javieezy_1-1663172931452.png

 

What I need is: 

-Depends on the Columna "SimpleDateLogOff" in Table 2, Add a column in Table 2 that returns the value of the Column "period" of Table 1. 

*Example: "SimpleDateLogOff" is 1/3/2022, which is between 12/12/2021 - 1/8/2022, hence should return "1" of "Periodo" column. 

 

Many thanks in advance, appreciate it! 

1 ACCEPTED SOLUTION
javieezy
Helper I
Helper I

Found a way: 

 

Add a custom column in Period Table using “List.Dates" function, to have all the dates between a period. 

 

Then just merge 2 tables. 

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @javieezy ;

Or you could in power query. first list.dates the merge it.

The final show:

vyalanwumsft_0-1663226472249.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @javieezy ;

You could create a measure or column by dax.

Measure.

Measure = CALCULATE(MAX('Period'[Periodo]),FILTER('Period',MAX('Data'[SimpleDateLogoff]) in CALENDAR([Start],[Finish])))

Column.

Column = CALCULATE(MAX('Period'[Periodo]),FILTER('Period','Data'[SimpleDateLogoff] in CALENDAR([Start],[Finish])))

The final show:

vyalanwumsft_0-1663223276325.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

javieezy
Helper I
Helper I

Found a way: 

 

Add a custom column in Period Table using “List.Dates" function, to have all the dates between a period. 

 

Then just merge 2 tables. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.