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.
Hi guys,
i want to calculate the cumulative sales of the last 5 for each week. I have 2 tables 1 for sales and 1 for week/month because i wil have other tables like for sales 2018,2017,2016 etc. and those tables will be linked to the week/month for comparative analisys.
PS. I dont have a date in the data so measures like this one wont help me 😕
Last4weeksSales = CALCULATE ( [Sum of Sales Measure], DATESINPERIOD ( 'Table'[Date], LASTDATE ( 'Table'[Date] ), -28, DAY ) )
Thanks in advance for your help 🙂
Solved! Go to Solution.
Try like this
Last4weeksSales =
_min_week = max([Week Number]) -4
_max_week = max([Week Number])
CALCULATE (
[Sum of Sales Measure],
all([Week Number]), [Week Number] >= _min_week && [Week Number] <=_max_week
)
In place of max, you might require maxx. Also, you need to adjust when the week becomes negative.
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Try like this
Last4weeksSales =
_min_week = max([Week Number]) -4
_max_week = max([Week Number])
CALCULATE (
[Sum of Sales Measure],
all([Week Number]), [Week Number] >= _min_week && [Week Number] <=_max_week
)
In place of max, you might require maxx. Also, you need to adjust when the week becomes negative.
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Thanks a Lot! it worked !
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
94 | |
75 | |
63 | |
62 |
User | Count |
---|---|
137 | |
105 | |
104 | |
80 | |
63 |