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
sieed
Helper II
Helper II

Creating Custom Date range

I am trying to create a custom date range that shows the last fifteen days no matter if there is data for that date in  my table or not. As long as it's in the last 15 days range, it should be shown on the graph. Here's my current graph: 

jobgrah.PNG

As you can see, it is not showing the last 15 days because I don't have any data pripr to March 1st. However, I need to display the last 15 day. I tried creatin a calculated column called Last15Days = toda() - date. However, this only displays dates which are in my data. So, for instance, Feb29th is not displayed although its in the last 15 days range. 

2 ACCEPTED SOLUTIONS

16 REPLIES 16
LaurentCouartou
Solution Supplier
Solution Supplier

I assume you do not have a dedicated Date table in your model. If not, add one and link it to your data. (Date tables are meant to solve this kind  of problems).

 

The most basic date table has only one column and contains a set of contiguous dates.

 

The quickest way to create one would be to add a calculated table to your model and use the CALENDARAUTO() function.

 

 

@LaurentCouartou, I have created a Date Table with the past fifteen dates. Question is, how do I join it with my current table? There isno common field between the two...  nI can share my pbix file but I dont know how to attach it. 

date is the common field in both tables. you can create link.

@rocky09,  the Date table contains a bunch of dates. There is no JobID. So, can't connect it. 

dCapture.JPG

@rocky09, sorry I had to just drag the line from the Job table to the date table and it worked. Thank you. 

norelation.PNG

@LaurentCouartouSo, do I have to jon this date table with my current table? How exactly does that work? 

I have already created the datwe table, but am not sure hwo tojoin it with the job table I have because there is no common field. I can share my pbix file but I am not sure how to attach it. 

rocky09
Solution Sage
Solution Sage

@sieedwhy you deleted your previous thread. And you are posting this question as New (My Solution for that thread?)

I did not delete the thread. I got a message saying that my post is under review and it's been an hour since I got that message. That's why I created a new one.  I di dnot even se eyour reply. Can you please post it again? 

oh. I thought, you have deleted the thread.

 

Try this:

xCapture.JPG

 

 

 

 

I tried that but dont' you think that would display all the dates without data as opposed the last fifteen dates? 

See, you can see all the 15 instances displaying (Blank Portion highlighted). I am newbie too, so that's what i got it in this situation.

yes but if I have a huge dataset, it would display every blank date as oppoed to the last fifteen dates. 

I don't think, it will display all the data as in the Date table, we have created the fields based on today -15 days, so, the date table limits data upto previous 15 days.

@rocky09, did you create those fields in the job table?  Leme show you how my data looks like: 

apptable.PNGjobtable.PNGdates.PNG

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.