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
riegersn
Helper I
Helper I

Group items by date using a set of start and end dates

So I have 2 tables. The data table has a resolvedDate (datetime). The other table, which I guess would be a dimension table, has an index column, start date and end date both in datetime. Id like to add a column on the data table that references the index to the dimension table using the resolvedDate that falls between the given start and end dates. I understand this may be simpler with ust dates and not datetimes but in this instance I need to group using the datetimes. Whats the best approach here?

 

riegersn_1-1643742995502.png

 

riegersn_0-1643742959815.png

 

1 ACCEPTED SOLUTION

Hi @riegersn 

 

Can you try the following:

 

Column = 

CALCULATE (
VALUES ( Table2[Index] ) ,
FILTER ( Table2 , Table2[Start Date] <= EARLIER ( Table1[Resolved] ) && Table2[End Date] >= EARLIER ( Table1[Resolved] ) ) )

 

Please make sure to adjust the names of your tables accordingly. 

 

Hope this helps.

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @riegersn ,

 

Don't seem to quite understand your requirements, there doesn't seem to be a related field between the two tables. Make sure this is the correct data model?


Can you provide relevant test data and screenshots of the desired results. Easy for me to answer for you as soon as possible. Looking forward to your feedback.


Best Regards,
Henry

 

TheoC
Super User
Super User

Hi @riegersn 

 

Can you try the following:

 

Column = 

CALCULATE (
VALUES ( Table2[Index] ) ,
FILTER ( Table2 , Table2[Start Date] <= EARLIER ( Table1[Resolved] ) && Table2[End Date] >= EARLIER ( Table1[Resolved] ) ) )

 

Please make sure to adjust the names of your tables accordingly. 

 

Hope this helps.

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi @riegersn 

 

Can you try the following:

 

Column = 

CALCULATE (
VALUES ( Table2[Index] ) ,
FILTER ( Table2 , Table2[Start Date] <= EARLIER ( Table1[Resolved] ) && Table2[End Date] >= EARLIER ( Table1[Resolved] ) ) )

 

Please make sure to adjust the names of your tables accordingly. 

 

Hope this helps.

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

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.