Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
HI,
I have Loaded Data Into PowerBI Which Already has Week Column present. I have created a Slicer for Location and Week , Where we can select Location and week number and my objective is to show Total of Sales handled in the week in the last 4 week before present week.
Example currently if Week 15 is selected, so column chart should show Week only 11,12,13,14 & Week 15 data.
If Week 3 is selected it should show Wk 1,2 & Wk 3 data. So dynamically it should change.
Even though i have tried creating Measure by learning online and through these forums like ->
These Column are Present In Data Table , Here Sales = TEU.... Kindly Help .....
Solved! Go to Solution.
Hi @Anonymous ,
You can create a separate week table and put the week field in the slicer. The week table is no related with the main table.
Measure = CALCULATE(SUM(Data[Teu]),FILTER(Data,[Week]<=SELECTEDVALUE(Week[Week])&&[Week]>=SELECTEDVALUE(Week[Week])-3))
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You can create a separate week table and put the week field in the slicer. The week table is no related with the main table.
Measure = CALCULATE(SUM(Data[Teu]),FILTER(Data,[Week]<=SELECTEDVALUE(Week[Week])&&[Week]>=SELECTEDVALUE(Week[Week])-3))
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , Create a week rank column in date table
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
lasy 5 week based on selection
Last 5 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-5 && 'Date'[Week Rank]<=max('Date'[Week Rank])))
lasy 5 week based on today
Last Week today =
var _st = today() +-1*WEEKDAY(today(),2)+1 -7 -35
var _end =today()+ 7-1*WEEKDAY(today(),2) -7
return
CALCULATE(SUM(Sales[Sales Amount]),filter('Date','Date'[Date]>= _st && 'Date'[Date]<=_end )) //use all('Date') if need in filter
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
72 | |
38 | |
31 | |
27 |
User | Count |
---|---|
92 | |
50 | |
44 | |
40 | |
35 |