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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
brumero
Helper I
Helper I

Comparar total por mes frente al promedio por mes por año

Hola

Estoy intentando generar un informe en Power BI, que muestra en un gráfico los gastos totales por mes con respecto al promedio por mes de la misma medida. He hecho este informe antes en Microstrategy, ahora quiero tener lo mismo en Power BI.

Este debería ser el gráfico final. Para tener en cuenta, hay una segmentación de datos en el informe, seleccionando ciertos años.

monthly average.png

1 ACCEPTED SOLUTION

Lo siento, @brumero - mi error, me refería a:

Average Measure = 
  VAR __Year = MAX('Table'[Year])
  VAR __Table = 
      SUMMARIZE(
        FILTER(ALL('Table'),[Year] = __Year),
        [Month],
        "__Value",SUM('Table'[Value])
      )
RETURN
  AVERAGEX(__Table,[__Value])

Son las cosas más pequeñas...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@brumero ,

tratar como

Averagex(Summarize(Filter(Table,Table[Year]=max(Table[year])),Table[Month],table[Year],"_sum",sum(Table[Value])),[_sum])
Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Gracias @amitchandak, pero por desgracia obtuve el mismo resultado:

avgyr.jpg

Lo siento, @brumero - mi error, me refería a:

Average Measure = 
  VAR __Year = MAX('Table'[Year])
  VAR __Table = 
      SUMMARIZE(
        FILTER(ALL('Table'),[Year] = __Year),
        [Month],
        "__Value",SUM('Table'[Value])
      )
RETURN
  AVERAGEX(__Table,[__Value])

Son las cosas más pequeñas...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Gracias @Greg_Deckler.

Funciona perfectamente

Lo siento por eso, sabía que necesitaba un todo allí, pero aparentemente en mi primer ir a solo se olvidó de incluirlo!! ¡Me alegro de que hayamos llegado!


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

Así que el promedio sería algo así como:

Average Measure = 
  VAR __Year = MAX('Table'[Year])
  VAR __Table = 
      SUMMARIZE(
        FILTER('Table',[Year] = __Year),
        [Month],
        "__Value",SUM('Table'[Value])
      )
RETURN
  AVERAGEX(__Table,[__Value])

Utilice un gráfico de columnas/líneas. El gráfico final tendrá un aspecto un poco diferente al de Power BI.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Gracias @Greg_Deckler ,

Lo había intentado, pero obtengo el mismo resultado que otros métodos. Déjeme mostrarle.

avgyr.jpg

$ Prom Año = 
  VAR __Year = MAX('01 Fecha'[Fecha].[Year])
  VAR __Table = 
      SUMMARIZE(
        FILTER('01 Fecha',[Year] = __Year),
        [Month],
        "__Value",SUM('05 Mayor PA'[Gasto U$D])
      )
RETURN
  AVERAGEX(__Table,[__Value])

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors
Top Kudoed Authors