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
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.

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!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

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.