March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
¡Buen día!
Tengo un gráfico de barras de stocks por días, y necesito obtener la diferencia entre el Stock final y el Stock inicial de la cantidad de días que se visualizan en el gráfico, el cual va variando a medida que pasa el tiempo.
¿Alguien sabe cómo hacerlo?
¡Gracias!
Solved! Go to Solution.
Hi @PaulinaGB,
It sounds like a rolling difference requirement based on the current date and the previous 5 days. You can try to use the following measure formula if it helps:
formula =
VAR _maxdate =
MAXX ( ALLSELECTED ( Table ), [Date] )
VAR currDate =
MAX ( Table[Date] )
RETURN
IF (
currDate >= _maxdate - 5,
CALCULATE (
SUM ( Table[Amount] ),
FILTER ( ALLSELECTED ( Table ), [Date] = currDate ),
VALUES ( Table[conjunto] )
)
- CALCULATE (
SUM ( Table[Amount] ),
FILTER ( ALLSELECTED ( Table ), [Date] = currDate - 5 ),
VALUES ( Table[conjunto] )
)
)
Regards,
Xiaoxin Sheng
@PaulinaGB ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.
refer if needed
How to use two Date/Period slicers
En este gráfico vemos el stock de los últimos 5 días. Necesito hacer la diferencia entre el Stock del día 10 y el Stock del día 5, y que se vaya actualizando; es decir, mañana necesito saber la diferencia del Stock del día 11 y el Stock del día 6 (siempre la diferencia de los últimos 5 días).
@PaulinaGB , Trailing 5 day measure can help
CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-5,Day))
prefer to use date table
Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Creo que no me expliqué bien. No tengo que sumar, tengo que restar. En el caso del ejemplo del gráfico tengo que hacer 9 (valor del día 10) - 8 (valor del día 5)
Hi @PaulinaGB,
It sounds like a rolling difference requirement based on the current date and the previous 5 days. You can try to use the following measure formula if it helps:
formula =
VAR _maxdate =
MAXX ( ALLSELECTED ( Table ), [Date] )
VAR currDate =
MAX ( Table[Date] )
RETURN
IF (
currDate >= _maxdate - 5,
CALCULATE (
SUM ( Table[Amount] ),
FILTER ( ALLSELECTED ( Table ), [Date] = currDate ),
VALUES ( Table[conjunto] )
)
- CALCULATE (
SUM ( Table[Amount] ),
FILTER ( ALLSELECTED ( Table ), [Date] = currDate - 5 ),
VALUES ( Table[conjunto] )
)
)
Regards,
Xiaoxin Sheng
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
120 | |
77 | |
59 | |
53 | |
40 |
User | Count |
---|---|
193 | |
106 | |
88 | |
62 | |
51 |