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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
I want to create a pie chart with NetSales based on Category of products. The slicer has year and week number. When I select week 12. i need the pie chart to show sum of net sales for the week 12,11,10 and 9. That is selected week plus previous 3 weeks. I have created week Rank column but I am not sure how to add the previous weeks with he current week.
Any Help appreciated
Thank you
Sam
Hi @samHil
Do you have a date column in your table? Can you share a sample of your data in a table format here?
BTW, If you have a date column, try to create a measure like this:
add a week No. column to your table and name it WeekNo
then, find the selected week No.:
Var _MaxWeek = WEEKNUM( SELECTEDVALUE([YourDateColumn]))
Var _MinWeek = _MaxWeek-4
then use these two variables to set a filter in your calculation:
filter(Table,WeekNo<=_MaxWeek&&WeekNo>=_MinWeek)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudosโ๏ธ!!
Hi @VahidDM ,
Thank you for the reply. It did not work like this "filter(Table,WeekNo<=_MaxWeek&&WeekNo>=_MinWeek)" . So i created a variables for each week , like selected week -1,selected week -2 etc. Then I used
and it worked. I am not sure why filter(Table,WeekNo<=_MaxWeek&&WeekNo>=_MinWeek) did not work
Check out the November 2025 Fabric update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!