Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Qué código le agrego a mi fórmula para que reinicie el contador, en este caso cada 12 meses.
Gracias por el apoyo. La fórmula de acumulado funciona correctamente pero quiero que reinicie en un determinado número de meses. para el ejemplo que presento en Marzo del 2021 debería volver a iniciar el acumulado.
Tengo tabla Calendario
Solved! Go to Solution.
Maybe you want something like this. We need to adjust the start date of each period to start a new running total. And if we change the start date, it will calculate the running total based on the new start date for the next 12 months.
Accumulative Total =
var firstStartDate = MINX(ALLSELECTED('calendar'),'calendar'[Date])
var curYear = MAX('calendar'[Year])
var startDate = DATE(IF(MAX('calendar'[Month])>=MONTH(firstStartDate),curYear,curYear-1), MONTH(firstStartDate), DAY(firstStartDate))
var endDate = EOMONTH(startDate,11)
RETURN
CALCULATE([Total],'calendar'[Date]>=startDate && 'calendar'[Date]<=endDate && 'calendar'[Date]<=MAX('calendar'[Date]))
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Your skills are excellent
Muchas gracias, eres inteligente.
Thank you so much.
Do you have a fiscal year column in your calendar table? If not, you can first add a calendar year column to it like below.
DAX:
Then add a filter on fiscal year to your current measure like below
Acumulado Ventas 2 =
VAR MaxFecha = MAXX(ALLSELECTED(Calendario),Calendario[Date])
VAR MinFecha = MINX(ALLSELECTED(Calendario),Calendario[Date])
Var Acumulado =
CALCULATE([Ventas],
FILTER(ALLSELECTED(Calendario), Calendario[Date]<= MAX(Calendario[Date]) && Calendario[Date] >= MinFecha && Calendario[Date] <= MaxFecha && Calendario[Fiscal Year] = MAX(Calendario[Fiscal Year])))
RETURN
Acumulado
In addition, if the year-end month is not February, there is an easier method to calculate the running total with DATESYTD function as this function can define a different year-end date. However as in your case the year-end month is Febaruay, the year-end date is "2-29" in leap years and "2-28" in other years, it seems not work very well with DATESYTD. Computing running totals in DAX - SQLBI
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
No creo que necesite un anio fiscal, sólo necesito indicar cuántos meses después quiero reiniciar el acumulado a partir de una fecha inicial.
Maybe you want something like this. We need to adjust the start date of each period to start a new running total. And if we change the start date, it will calculate the running total based on the new start date for the next 12 months.
Accumulative Total =
var firstStartDate = MINX(ALLSELECTED('calendar'),'calendar'[Date])
var curYear = MAX('calendar'[Year])
var startDate = DATE(IF(MAX('calendar'[Month])>=MONTH(firstStartDate),curYear,curYear-1), MONTH(firstStartDate), DAY(firstStartDate))
var endDate = EOMONTH(startDate,11)
RETURN
CALCULATE([Total],'calendar'[Date]>=startDate && 'calendar'[Date]<=endDate && 'calendar'[Date]<=MAX('calendar'[Date]))
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
89 | |
82 | |
65 | |
51 | |
31 |
User | Count |
---|---|
119 | |
113 | |
72 | |
62 | |
46 |