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
Anonymous
Not applicable

Date Range

Hi all, 

 

My client has requested me to have a specific date range within a chart. 

Can anyone show me how to create a date range as follows: 

Min Date: Current Month - 2

Max Date Current Month +6

This should cover 9 months of data. 

 

Thank you.

1 ACCEPTED SOLUTION

Hi @Anonymous 


You can downlad this calendar table and apply the filter as below.

 

image.png

Regards,
Mariusz

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

View solution in original post

13 REPLIES 13
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

You shoud be able to use Relative date filtering.
https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

Regards,
Mariusz

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

Anonymous
Not applicable

Hi @Mariusz 

 

I do know how relative date filtering works, but I have not been able to set it for the specified range: 

Min Date: Current Month - 2

Max Date Current Month +6

This should cover 9 months of data. 

 

Do you know how to do it ?

 

Thanks! 

Hi @Anonymous 


You can downlad this calendar table and apply the filter as below.

 

image.png

Regards,
Mariusz

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

Anonymous
Not applicable

@Mariusz Thanks for helping me with this, I am however solutioning this in a established data mdel. 

Can you please let me know how did you build the sYear field?

 

Hi @Anonymous 

Please download the file and see the Query Steps it should be fairly easy to understad.

If you are struggling then please let me know.

Regards,
Mariusz

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

Anonymous
Not applicable

@Mariusz 

I am almost there, 

Date.Year([Date]) - nowYear is the custom column sYear

However how do I get the variable nowYear? 

 

Thanks 

Hi @Anonymous 

This will be 
nowYear = Date.Year(nowDate)
nowDate = Date.From(nowDateTime)
nowDateTime = DateTime.LocalNow()

Hope this helps.

Mariusz

Anonymous
Not applicable

@Mariusz are these also columns ? 

Hi @Anonymous 

Now this are queries in variebles folder

Thanks

Mariusz

Anonymous
Not applicable

Ok @Mariusz thank you so much! I will mark your solution as accepted. 

I have one other thing I need your help. I will open a new ticket.

Thanks. 

Anonymous
Not applicable

@Mariusz 

There is one issue, I do not have the advanced filter options as you do.

I do not have "Less than or equal to" for example. 

filter.png

Hi @Anonymous 

 

Make sure you chage the data type in query editor to Whole Number. 

image.png


Regards,
Mariusz

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

Anonymous
Not applicable

@Mariusz done! 

Perfect! 

cheers 

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.

Top Solution Authors