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.
Hola a todos
¿Cómo calcular las ventas del año pasado para el mismo período de tiempo en el editor de consultas? Necesito usar la opción Unpivot, por lo tanto, necesito clacular aquellos en Editar consulta.
Gracias de antemano!
Mes | Venta | Venta del año pasado |
Enero-19 | 100 | |
Feb-19 | 200 | |
Mar-19 | 300 | |
Abr-19 | 400 | |
19 de mayo | 500 | |
Jun-19 | 600 | |
Jul-19 | 700 | |
19 de agosto | 800 | |
Sep-19 | 900 | |
Oct-19 | 1000 | |
Nov-19 | 1100 | |
Dic-19 | 1200 | |
Enero-20 | 1300 | 100 |
Feb-20 | 1400 | 200 |
Mar-20 | 1500 | 300 |
Abr-20 | 1600 | 400 |
20 de mayo | 1700 | 500 |
Junio-20 | 1800 | 600 |
Jul-20 | 1900 | 700 |
20 de agosto | 2000 | 800 |
Sep-20 | 2100 | 900 |
Oct-20 | 2200 | 1000 |
Nov-20 | 2300 | 1100 |
Dic-20 | 2400 | 1200 |
Solved! Go to Solution.
Hola @sam16 ,
Necesita combinar tablas. Por favor, intente así:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc/JDYBADEPRXnJGIsnstYzovw0EDgq+Pvngv7fYaaerLTnEVOU6tniSB5WkElSTalBLakE9qQeNpBE0k2bQSlpBpvQ18B/wFdgvwb4GDF0fK5QKq9QKaxQL61QLG5QLm9QLWxT8misVw4yTgc7JwMLJwDflugE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Month = _t, Sale = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type date}, {"Sale", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.AddYears([Month],-1)),
#"Merged Queries" = Table.NestedJoin(#"Added Custom", {"Custom"}, #"Added Custom", {"Month"}, "Added Custom", JoinKind.LeftOuter),
#"Expanded Added Custom" = Table.ExpandTableColumn(#"Merged Queries", "Added Custom", {"Sale"}, {"Sale.1"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Added Custom",{"Custom"})
in
#"Removed Columns"
@sam16, con inteligencia de tiempo se puede probar
Last year MTD Sales ? CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
Año detrás de Ventas: CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
En caso de que se necesite ytd
Last YTD Sales á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únase a ella con la columna de fecha de su/s hecho/s. Consulte:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Vea si mi seminario web sobre Time Intelligence puede ayudar: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Apreciamos tus Felicitaciones.
Es necesario colocarlo en el editor de consultas con M lang., para que pueda usar Unpivot Propery para algunas columnas.
Hola @sam16 ,
Necesita combinar tablas. Por favor, intente así:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc/JDYBADEPRXnJGIsnstYzovw0EDgq+Pvngv7fYaaerLTnEVOU6tniSB5WkElSTalBLakE9qQeNpBE0k2bQSlpBpvQ18B/wFdgvwb4GDF0fK5QKq9QKaxQL61QLG5QLm9QLWxT8misVw4yTgc7JwMLJwDflugE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Month = _t, Sale = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type date}, {"Sale", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.AddYears([Month],-1)),
#"Merged Queries" = Table.NestedJoin(#"Added Custom", {"Custom"}, #"Added Custom", {"Month"}, "Added Custom", JoinKind.LeftOuter),
#"Expanded Added Custom" = Table.ExpandTableColumn(#"Merged Queries", "Added Custom", {"Sale"}, {"Sale.1"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Added Custom",{"Custom"})
in
#"Removed Columns"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |