cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nosheen
Frequent Visitor

Medida Porcentaje de cálculo diferencia de las ventas de la semana actual por promedio de sus ventas anteriores

Hola a todos, tengo un dato en el siguiente formato

TiendaSemanaVentas
X9555
X8647
X7889
X6846
X5558
X4993
Y9736
Y8746
Y7927
Y6601
Y5509
Y4589
Z9964
Z8578
Z7833
Z6992
Z5558
Z4739

y quiero crear una tabla de resumen (usando power BI table visual) según golpe

semana actualPromedio anterior%diff
Tienda X555786.60-29.4%
Tienda Y736674.409.1%
Tienda Z964740.0030.3%

¿Cómo puedo hacer esto más eficientemente para que cada semana no tengo que filtrar manualmente nada .por ejemplo, si se agregan ventas de la semana 10 entonces la semana actual debe ser movido a la semana 10 y todas las semanas anteriores deben incluirse en la semana anterior avg.

Cómo incluir esta automatización en la medida % diff y otras columnas donde actualmente estoy usando filtros

Su ayuda será apreciada.

Gracias.

3 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Parece que:

Current Week Measure =
  VAR __Store = MAX('Table'[Store])
  VAR __MaxWeek = MAXX(FILTER('Table',[Store] = __Store),[week])
RETURN
  MAXX(FILTER('Table',[Store] = __Store && [week] = __MaxWeek),[sales])

@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

View solution in original post

Greg_Deckler
Super User
Super User

Para el promedio anterior:

Previous Avg Measure =
  VAR __Store = MAX('Table'[Store])
  VAR __MaxWeek = MAXX(FILTER('Table',[Store] = __Store),[week])
RETURN
  AVERAGEX(FILTER('Table',[Store] = __Store && [week] <> __MaxWeek),[sales])

@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

View solution in original post

Greg_Deckler
Super User
Super User

Para % diff:

%Diff Measure = 
  ([Current Week Measure] - [Previous Avg Measure]) / [Previous Avg Measure]

@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

Para % diff:

%Diff Measure = 
  ([Current Week Measure] - [Previous Avg Measure]) / [Previous Avg Measure]

@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

View solution in original post

Greg_Deckler
Super User
Super User

Para el promedio anterior:

Previous Avg Measure =
  VAR __Store = MAX('Table'[Store])
  VAR __MaxWeek = MAXX(FILTER('Table',[Store] = __Store),[week])
RETURN
  AVERAGEX(FILTER('Table',[Store] = __Store && [week] <> __MaxWeek),[sales])

@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

View solution in original post

Greg_Deckler
Super User
Super User

Parece que:

Current Week Measure =
  VAR __Store = MAX('Table'[Store])
  VAR __MaxWeek = MAXX(FILTER('Table',[Store] = __Store),[week])
RETURN
  MAXX(FILTER('Table',[Store] = __Store && [week] = __MaxWeek),[sales])

@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

View solution in original post

Gracias Greg, trabajó como un encanto 🙂

¡Impresionante! 🙂

@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

GrahamKnowles
Resolver I
Resolver I

Suponiendo que está utilizando solo una semana numerada en lugar de una tabla de fechas, podría agregar una columna personalizada a la tabla para lograr esto.

Así que cree una columna personalizada como:

Semana más reciente: MAX(Tabla[semana])

entonces una segunda columna para dictar si una línea está en la semana actual o la semana pasada:

IsCurrentWeek á if(Table[week]-Table[Latest Week],"Current",if(Table[week]-(Table[Latest Week]-1),"Last Week","Not Current")
A continuación, puede realizar más cálculos de estos resultados.
¿Esto ayuda?
amitchandak
Super User
Super User

@Nosheen

Consulte este archivo , Cómo creo semana , la semana pasada / anterior usando Rango. En caso de que solo tenga datos de un año, puede usar Week

https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors