Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi team,
I have a request to create a custom date horizon. What does this mean? I am working with forecast snapshots. For instance, if I select this week's snapshot, I will see the forecast for the next 26 weeks.
What business needs is to modify the weeks covered in the visual. They don't need to see the full 26 weeks, but only the next 13 weeks or 17 weeks.
Using Zoom Slider does not work as the column used for Weeks dimension is Text.
What I thought was to create a ranking in the visual based on the snapshot. In other words, create a ranking for all 26 weeks which are forecasted (0-25) and use a parameter to let the user decide how many weeks should be in the visual.
This is the code that I wrote, but doesn't work. What am I missing? Also, if you have any other way of doing this, i'm open to suggestions.
In the table I only have YearAndWeek column and the Calendar Horizon measure.
Can you please help?
Solved! Go to Solution.
Hi @SeGr
Thanks for reaching out to us.
you can try this measure
filtermeasure =
var _week1=MINX(ALLSELECTED(weeks),[value])
var _week2=MAXX(ALLSELECTED(weeks),[value])
var _date1= MINX(ALLSELECTED('calendar'),[Date])
var _date2= MAXX(ALLSELECTED('calendar'),[Date])
var _date3= _date1+_week1*7
var _date4= _date2+_week2*7
return
IF(MIN('Table'[date]) >=_date3 && MIN('Table'[date])<=_date4,1,0)
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
I found a more efficient way of doing this - define an upper and lower bound and calculate the measure to be between those 2. Make the upper bound to be dependent of a parameter to make it dynamic.
Hi @SeGr
Thanks for reaching out to us.
you can try this measure
filtermeasure =
var _week1=MINX(ALLSELECTED(weeks),[value])
var _week2=MAXX(ALLSELECTED(weeks),[value])
var _date1= MINX(ALLSELECTED('calendar'),[Date])
var _date2= MAXX(ALLSELECTED('calendar'),[Date])
var _date3= _date1+_week1*7
var _date4= _date2+_week2*7
return
IF(MIN('Table'[date]) >=_date3 && MIN('Table'[date])<=_date4,1,0)
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.