Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
saharmal
New Member

Default values of a numeric slicer

Hi everyone,
I'm trying to set a default values to a slicer - 
The field inside the slicer is in the format of "YEAR.WW" and the data type is a decimal number.
By default - the current values of the slicer is from 2020.17 to 2020.35 (I don't know why).
I want the default values to be the last 8 weeks (relative to current week & dynemicly changing every week).

I Know that it can be done by using a date field and choosing the "relative" option, but then - I didn't found a way to play with the range (for example - if I want to slice from 2020.12 to 2020.18).

Is there any way to do it?

Thanks.

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@saharmal 

You can add a column to your table to convert the YYYY.WW to relevant week ending dates and use the date column on the slicer to set Past 8 Week filter.

Date = 
var year = INT(Table6[YYYY.WW])
var week = (Table6[YYYY.WW] - year) * 100
return
DATE(year,1,-2)-WEEKDAY(DATE(year,1,3))+week*7



Fowmy_0-1599998981269.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @saharmal ,

 

You may create a measure to judge if the the week is in last 8 weeks and add this measure to visual filter.

Measure = 
var currentweek = YEAR(TODAY())&WEEKNUM(TODAY(),2)
return
IF(SELECTEDVALUE('Table'[year.week])+0>currentweek-8&&SELECTEDVALUE('Table'[year.week])<=currentweek-0,1,0)

1.PNG 

 

Best Regards,

Jay

Fowmy
Super User
Super User

@saharmal 

You can add a column to your table to convert the YYYY.WW to relevant week ending dates and use the date column on the slicer to set Past 8 Week filter.

Date = 
var year = INT(Table6[YYYY.WW])
var week = (Table6[YYYY.WW] - year) * 100
return
DATE(year,1,-2)-WEEKDAY(DATE(year,1,3))+week*7



Fowmy_0-1599998981269.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

AllisonKennedy
Super User
Super User

Unfortunately you can't have both relative and between in the same slicer. You could try the 'between' option, but there's no way to make the default dynamic.

You could add another filter for date (either as a slicer or as a filter on the slicer) that sets to last 8 weeks/2 months. That will force the YYYY.WW slicer to filter, and still leave the YYYY.WW slicer as between or list. Only if you clear the date filter/slicer will you be able to choose a date range more than 2 months ago. Does that make any sense and would it work?

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.