cancel
Showing results for 
Search instead for 
Did you mean: 
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

Accepted Solutions
Super User
Super User

Re: Date Range

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
Super User
Super User

Re: Date Range

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

Re: Date Range

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! 

Super User
Super User

Re: Date Range

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

Anonymous
Not applicable

Re: Date Range

@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?

 

Super User
Super User

Re: Date Range

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

Re: Date Range

@Mariusz 

I am almost there, 

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

However how do I get the variable nowYear? 

 

Thanks 

Super User
Super User

Re: Date Range

Hi @Anonymous 

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

Hope this helps.

Mariusz

Anonymous
Not applicable

Re: Date Range

@Mariusz are these also columns ? 

Super User
Super User

Re: Date Range

Hi @Anonymous 

Now this are queries in variebles folder

Thanks

Mariusz

Helpful resources

Announcements
New Ranks and Rank Icons in 2020

New Ranks and Rank Icons in 2020

Read the announcement for more information!

New Kudos Given Badges Coming

New Kudos Given Badges Coming

We're rolling out new Kudos Given badges. Find out how many Kudos you've given.

November 2019 Community Highlights

November 2019 Community Highlights

Get an overview of the events and great community content from November.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)