Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Semana anterior usando una secuencia de semanas

Hola

Tengo 2 tablas ('Ventas' & 'Calendario') - calendario que contiene fechas futuras - y necesito calcular la semana anterior basado en un número de secuencia de semana (espero que esto resolverá el problema de wk 1 yyyy !)

Tengo lo siguiente (y he probado un par de otros métodos) pero no parece funcionar como se esperaba;

PrevWkSales :
CALCULAR(
SUM('Sales'[CountOf]),

FILTRO('Calendario',

'Calendar'[WeekSequence] á 'Calendar'[WeekSequence] -1

)

)

Cualquier ayuda sería apreciada 🙂

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hola @afil1

probar ALL()

PrevWkSales :=
CALCULATE(
SUM('Sales'[CountOf]),
FILTER(ALL('Calendar'),
'Calendar'[WeekSequence] = 'Calendar'[WeekSequence] -1
)
)


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

6 REPLIES 6
az38
Community Champion
Community Champion

Hola @afil1

probar ALL()

PrevWkSales :=
CALCULATE(
SUM('Sales'[CountOf]),
FILTER(ALL('Calendar'),
'Calendar'[WeekSequence] = 'Calendar'[WeekSequence] -1
)
)


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Gracias @az38, sólo dio un torbellino y no devuelve nada (como se experimentó en 😞 anteriormente)

amitchandak
Super User
Super User
Anonymous
Not applicable

Gracias @amitchandak, me había encontrado con esto sin embargo si hay fechas futuras en la tabla, el rango máximo no funciona, ya que clasifica las fechas futuras, así como las fechas pasadas?

@afil1 , En caso de que tenga una fecha futura que necesita, tenga un filtro en la página o puede modificar la fórmula para tener sólo la última semana

This Week = 
var var _max1 =maxx('order',[Order date])
var _week =maxx(filter('Date','Date'[Date]=_max1),[Week Rank])
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=_week))


Last Week = var var _max1 =maxx('order',[Order date])
var _week =maxx(filter('Date','Date'[Date]=_max1),[Week Rank])-1
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=_week))

Puede utilizar Hoy en lugar de la fecha máxima de la tabla

Anonymous
Not applicable

@az38 y @amitchandak, debo disculparme. @az38 su solución funcionó. Mi secuenciación estaba cruzando en las semanas y es por eso que no estaba trabajando.

Gracias por su ayuda (Y)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.