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 everyone,
I have a table of daily sales, and Need to calculate the running total of current day + previous 4 days ..
Example below:
Any help or advice please ?
Solved! Go to Solution.
@Anonymous , Create a measure like, Prefer date tbale
Rolling 4 = CALCULATE(Sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-4,DAY))
or
Rolling 4 = CALCULATE(Sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-5,DAY))
Hi @Anonymous ,
You need to create a measure that picks up the last date try something similar to:
Running 4 days =
CALCULATE (
SUM ( TAble[Sales] ),
FILTER (
ALL ( Table[Date] ),
Table[Date] <= MAX ( Table[Date] )
&& Table[Date]
>= MAX ( Table[Date] ) - 4
)
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous
First you will probably need a datetable in your model. After that you can achieve this with the DATESINPERIOD function in a measure like this.
Current and Previous 4 days =
CALCULATE(
SUM('Table'[Sales]),
DATESINPERIOD(Datetable[Date], MAX(Datetable[Date]), -5, DAY))
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
Best regards,
Jeroen
@Anonymous , Create a measure like, Prefer date tbale
Rolling 4 = CALCULATE(Sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-4,DAY))
or
Rolling 4 = CALCULATE(Sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-5,DAY))
How to do calculation for above solution if dates are having alternate 7 days date.
ex.
01-08-2023
08-08-2023
15-08-2023
like this.
please porvide solution, I tried using this bt data is not given properly
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 |
---|---|
114 | |
100 | |
81 | |
70 | |
62 |
User | Count |
---|---|
148 | |
116 | |
104 | |
90 | |
65 |