Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hola
Soy un novato en Powerbi y quiero crear un gráfico de líneas que muestre un total acumulado desglosado por años pero el gráfico lo mostraría mensualmente, también me gustaría tener una opción de filtro que al seleccionarla solo me mostrara las cifras de esa categoría. Vea la tabla a continuación:
Fecha | categoría | beneficio |
01/01/2023 | 1 | 966 |
07/01/2023 | 2 | 825 |
10/01/2023 | 1 | 413 |
05/02/2023 | 1 | 468 |
05/02/2023 | 1 | 692 |
07/03/2023 | 2 | 404 |
14/03/2023 | 1 | 341 |
14/05/2023 | 2 | 391 |
19/05/2023 | 1 | 300 |
19/05/2023 | 3 | 323 |
19/05/2023 | 1 | 503 |
20/06/2023 | 2 | 322 |
20/06/2023 | 2 | 441 |
17/07/2023 | 1 | 930 |
19/07/2023 | 1 | 237 |
02/09/2023 | 2 | 368 |
10/10/2023 | 1 | 793 |
11/11/2023 | 2 | 349 |
13/11/2023 | 1 | 756 |
12/12/2023 | 1 | 932 |
24/12/2023 | 2 | 692 |
01/01/2024 | 1 | 273 |
07/01/2024 | 2 | 849 |
10/01/2024 | 2 | 770 |
05/02/2024 | 1 | 898 |
05/02/2024 | 1 | 104 |
07/03/2024 | 1 | 450 |
14/03/2024 | 2 | 339 |
14/05/2024 | 1 | 207 |
19/05/2024 | 2 | 703 |
19/05/2024 | 1 | 405 |
19/05/2024 | 3 | 502 |
20/06/2024 | 1 | 580 |
20/06/2024 | 2 | 352 |
17/07/2024 | 1 | 552 |
19/07/2024 | 1 | 624 |
02/09/2024 | 1 | 493 |
10/10/2024 | 2 | 398 |
11/11/2024 | 2 | 299 |
13/11/2024 | 1 | 407 |
12/12/2024 | 1 | 698 |
24/12/2024 | 1 | 911 |
Entonces, el gráfico mostraría los meses en la parte inferior, los montos a la izquierda y tendría una línea por año como suma acumulada, luego puedo filtrar por la categoría
Espero haber tenido algún sentido aquí.
Hola @zuber85 ,
@Corey_M ¡Buena respuesta! Pero creo que te olvidas de calcular el total acumulado desglosado por años, solo calculas el total de cada mes de cada año.
Y @zuber85 Si no necesita que todos los meses se muestren en la parte inferior, puede usar la jerarquía de fechas que se incluye con Power BI Desktop directamente o usar DAX:
Month = MONTH('Table'[Date])
Y elijo agregar una nueva segmentación de tablas para filtrar por la categoría (Para eliminar algunos de los efectos en el filtrado, sugeriría agregar una nueva tabla) :
A continuación, utilice este DAX para crear una medida para calcular el valor Total acumulado desglosado por años:
cumulative total broken down by years =
CALCULATE(
SUM('Table'[profit]),
ALL('Table'),
YEAR('Table'[Date]) = YEAR(MAX('Table'[Date])) && MONTH('Table'[Date]) <= MONTH(MAX('Table'[Date])) && 'Table'[category] IN VALUES('Slicer'[category])
)
Y el resultado final es el siguiente:
Saludos
Dino Tao
Si esta publicación ayuda, considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Las tablas de fechas son un tema muy común en PowerBI y te ayudarán mucho aquí.
Aquí hay una tabla de ejemplo que puede ayudarlo a comenzar (https://chandoo.org/wp/power-query-calendar-table-best-method/ )
let
Source = List.Dates(#date(2023,1,1),365, #duration(1,0,0,0)),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}}),
#"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([Date]), Int64.Type),
#"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month", each Date.Month([Date]), Int64.Type),
#"Inserted Month Name" = Table.AddColumn(#"Inserted Month", "Month Name", each Date.MonthName([Date]), type text),
#"Inserted Day of Week" = Table.AddColumn(#"Inserted Month Name", "Day of Week", each Date.DayOfWeek([Date]), Int64.Type),
#"Inserted Day Name" = Table.AddColumn(#"Inserted Day of Week", "Day Name", each Date.DayOfWeekName([Date]), type text),
#"Added Conditional Column" = Table.AddColumn(#"Inserted Day Name", "Is Weekend?", each if [Day of Week] = 6 then "Yes" else if [Day of Week] = 0 then "Yes" else "No"),
#"Inserted Start of Month" = Table.AddColumn(#"Added Conditional Column", "Start of Month", each Date.StartOfMonth([Date]), type date),
#"Added Custom" = Table.AddColumn(#"Inserted Start of Month", "Year Month", each [Year] * 100 + [Month]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Current Month", each let cm = Date.StartOfMonth(DateTime.LocalNow())
in Date.Year(cm) * 100 + Date.Month(cm)),
#"Inserted Subtraction" = Table.AddColumn(#"Added Custom1", "Subtraction", each [Year Month] - [Current Month], type number),
#"Added Conditional Column1" = Table.AddColumn(#"Inserted Subtraction", "Month Type", each if [Subtraction] = 0 then "This Month" else if [Subtraction] = 1 then "Next Month" else if [Subtraction] = -1 then "Previous Month" else "Other Month"),
#"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column1",{"Current Month", "Subtraction"})
in
#"Removed Columns"
Una vez que tenga una configuración de DateTable, cree una relación entre las fechas de su tabla y la tabla de fechas.
luego simplemente cree un gráfico de líneas con Mes en el eje X, Suma de ganancias en el eje Y y Año en la leyenda
Lo último es agregar una segmentación en la que pueda colocar la categoría, lo que le permite filtrar a esa categoría.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
Check out the May 2024 Power BI update to learn about new features.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |