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

Relative time filters not in the past x months

Hi,

 

I know that when you have a date field you can filter on relatieve date. Say if I want to see all the people who are under the age of 18 I can filter on date of birth "in the past" and then say 18 years. However If want to see everyone who is older than 18. However I can't find a option that enables me to do so. 

 

I could make some code in the dataset I use but since I have no need of refreshing the dataset so much I would rather solve it in PowerBI as I understand the filter will automaticly adapt to todays date. At least it does in desktop, I have yet to test it on the server.

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Yes, the use of calculated columns does cause such a situation, so it is recommended to manually refresh the data set every time you open the report.

As a workaround, you can  convert the calculated column to measure.Then drag this measure to visual filter pane.

 

Age = DATEDIFF( MAX('Table'[Date of Birth]),TODAY(),YEAR)

 

20.png

Best Regards,
Community Support Team _ Eason
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

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Yes, the use of calculated columns does cause such a situation, so it is recommended to manually refresh the data set every time you open the report.

As a workaround, you can  convert the calculated column to measure.Then drag this measure to visual filter pane.

 

Age = DATEDIFF( MAX('Table'[Date of Birth]),TODAY(),YEAR)

 

20.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , You can create a new column Age with today

 

Age = datediff([Date of birth], today(), year)

 

Use this one filter or visual level filter

Anonymous
Not applicable

Hi Amitchandak,

 

Thank you for your time.

I was under the impression that when I make a colomn like that I need to refresh the data every day to make it  accurate. Thus this solution won't work for me. Or is my understanding of how the dataset in built wrong and does it do all the calculations I make in PowerBI dataset again everytime a open a dashboard on the server or the desktop?

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.