cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DaveAl
Frequent Visitor

Date Ranges Without a Row for Each Date

Hello All,

 

I've got a client dataset that includes non-standard date groupings, and they're expressed as ranges with StartDate and EndDate. It's 10+ years worth of data, so I'd rather not generate a row for each day if possible. Example table:

 

PeriodStartDateEndDate
FirstJan 01, 01Feb 01, 01
SecondFeb 02, 01Mar 06, 01
ThirdMar 07, 01Aug 13, 01
FourthAug 14, 01Jan 02, 02
FifthJan 03, 02March 08, 02
SixthMarch 09, 02May 11, 02

 

What I'd like to be able to do is introduce a date slicer, so that if a person chooses a date within the described timeframe, it will only display that period. E.G. If a person selected August 16, 01 then they would be shown the Fourth period because it is between the start and end dates.

 

I'm really struggling to find a way to make that work. Is such a thing even possible, and if so will someone point me in the right direction?

 

Thanks a million!

1 ACCEPTED SOLUTION
DaveAl
Frequent Visitor

As I mentioned in the initial question, a calendar table is not an acceptable solution for my client. 

 

That said, I did figure it out myself. If anyone is looking to do something similar, you can use CALCULATE and FILTER([Date] >= [StartDate] && [Date] <= [EndDate]).

 

Thanks for all your help.

View solution in original post

5 REPLIES 5
DaveAl
Frequent Visitor

As I mentioned in the initial question, a calendar table is not an acceptable solution for my client. 

 

That said, I did figure it out myself. If anyone is looking to do something similar, you can use CALCULATE and FILTER([Date] >= [StartDate] && [Date] <= [EndDate]).

 

Thanks for all your help.

v-xiaotang
Community Support
Community Support

Hi @DaveAl 

Thanks for your solution 🙂

 

Best Regards,

Community Support Team _Tang

v-xiaotang
Community Support
Community Support

Hi @DaveAl 

As AlexisOlson  and smpa01 recommended, you do need a calendar table, then you can create a measure to get the period.

If you need more help, you can @ me. 

Is the above answer helpful? Could you accept the answer helpful as the solution? Thanks

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

AlexisOlson
Super User
Super User

A row per day (a calendar date dimension table) is the simplest solution. 10 years * 365 days/year is only a few thousand rows, which is tiny compared to what Power BI can handle. You typically want a calendar table for modeling purposes anyway.

smpa01
Super User
Super User

@DaveAl  the best way to deal with it, is to use a calendar table.

 

Bring axis (slicer, date values from-to) from calendar table. At the same time create a calculated colum in the calendar table that would assign the the "Period" classification from the above to table to there.

 

End users uses the values from calendar table and it would corrrectly slice the vize according to the Period (custom Period defined by you)





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

Proud to be a Super User!






New Animated Dashboard: Sales Calendar


Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors