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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
rachaelwalker
Resolver III
Resolver III

Datos de grupo por semana y los lunes

Estoy tratando de agrupar datos por semana/lunes. Tengo una tabla de datos de fecha y otra tabla de datos llamada iAuditor Reports. En la tabla de fechas tengo una columna "inicio de la semana" para calcular los lunes usando la siguiente fórmula

Inicio de la semana: IF(WEEKDAY('Query2'[Date],2)-1,'Query2'[Date],DATEADD('Query2'[Date],-WEEKDAY('Query2'[Date],2)+1,DAY))

Las tablas se relacionan mediante el campo de fecha

sin embargo, cuando creé un gráfico de barras básico o un objeto visual de tabla, no parece que estén relacionados (visual derecho) El objeto visual de la izquierda solo utiliza datos de la tabla iauditor. El objeto visual de la derecha utiliza datos de ambas tablas

power bi visuals.png

table.png

¿Hay alguna fórmula que necesite usar para crear una columna de inicio de semana/lunes en mi tabla iauditor? Lo siento de antemano si le expliqué eso horriblemente. Soy un principiante.

2 ACCEPTED SOLUTIONS

@parry2k Te envié un enlace a tu correo electrónico

View solution in original post

@parry2k Gracias por tomarse el tiempo para resolver este problema. Agradecido fue una solución fácil y apreciar a todos los que se toman el tiempo.

Resolución: el campo Fecha de la tabla iauditor no se estableció en el tipo de datos "Fecha".

View solution in original post

15 REPLIES 15
v-zhenbw-msft
Community Support
Community Support

Hola @rachaelwalker ,

Por favor revise su tabla de fechas, si comienza el lunes.

Si no se inicia el lunes, la columna Semana tendrá un valor en blanco, como la siguiente captura de pantalla.

G1.jpg

G2.jpg

Tal vez usted refiere este método, crear una columna de cálculo para obtener la fecha mínima de cada semana.

1. Cree una columna de año y una columna de semana en la tabla de fechas.

Year = YEAR(Query2[Date])
weeknum = WEEKNUM(Query2[Date],2)

G3.jpg

2. Luego cree una nueva columna de inicio de la semana.

New Week starting = CALCULATE(MIN(Query2[Date]),FILTER(Query2,Query2[weeknum]=EARLIER(Query2[weeknum]) && Query2[Year]=EARLIER(Query2[Year])))

G4.jpg

3. Por fin crear una relación de varios a uno entre la tabla de hechos y la tabla de fechas.

G5.jpg

G6.jpg

Si no cumple con sus requisitos, ¿podría proporcionar una muestra de maqueta basada en datos falsos o describir los campos de cada tabla y las relaciones entre tablas simplemente?

Será útil si puede mostrarnos el resultado esperado exacto basado en las tablas.

Cargue sus archivos en OneDrive para la Empresa y comparta el enlace aquí. Por favor, no contenga ninguna Información Confidencial o Datos Reales en su respuesta.

Saludos

Equipo de apoyo a la comunidad _ zhenbw

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.


BTW, pbix como adjunto.

parry2k
Super User
Super User

@rachaelwalker puede compartir la relación entre estas dos tablas?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@rachaelwalker esto es raro, puede cambiar la dirección del filtro cruzado a solo, en lugar de ambos. No se recomienda tener dirección de relación con ambos.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Cambié el filtro cruzado y parece el mismo

@rachaelwalker de la tabla de calendarios tiene todas las fechas para el año 2020.

Compruebe este mensaje para la tabla de calendario, aunque ya lo tiene, pero asegúrese de que tiene fechas en la tabla de calendario para cubrir las fechas de la tabla del auditor.

https://perytus.com/2020/05/22/create-a-basic-date-table-in-your-data-model-for-time-intelligence-ca...

Me gustaría elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!

Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionadas con Power BI.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k sí, tiene todas las fechas hasta 2025. ¿Sería como tengo mi configuración de tabla de fechas? Creé una función personalizada (consulta 1) y otra consulta personalizada para llamar a la consulta una para las fechas

custom fx - consulta 1

(StartDate as date, EndDate as date, FYStartMonth as number) como tabla ?>
Dejar
DayCount ? Duration.Days(Duration.From(EndDate - StartDate)),
Origen: List.Dates(StartDate,DayCount,#duration(1,0,0,0)),
TableFromList ? Table.FromList(Source, Splitter.SplitByNothing()),
ChangedType á Table.TransformColumnTypes(TableFromList,-"Column1", tipo date-),
RenamedColumns ? Table.RenameColumns(ChangedType,'Column1", "Date" ? )
InsertYear ? Table.AddColumn(RenamedColumns, "Year", each Date.Year([Date]),type text),
InsertYearNumber ? Table.AddColumn(RenamedColumns, "YearNumber", each Date.Year([Date])),
InsertQuarter á Table.AddColumn(InsertYear, "QuarterOfYear", each Date.QuarterOfYear([Date])),
InsertMonth á Table.AddColumn(InsertQuarter, "MonthOfYear", each Date.Month([Date]), escriba texto),
InsertDay ? Table.AddColumn(InsertMonth, "DayOfMonth", each Date.Day([Date])),
InsertDayInt ? Table.AddColumn(InsertDay, "DateInt", cada [Año] * 10000 + [MonthOfYear] * 100 + [DayOfMonth]),
InsertMonthName ? Table.AddColumn(InsertDayInt, "MonthName", each Date.ToText([Date], "MMMM"), escriba texto), escriba texto),
InsertCalendarMonth á Table.AddColumn(InsertMonthName, "MonthInCalendar", cada uno (try(Text.Range([MonthName],0,3)) de lo contrario [MonthName]) & " " & Number.ToText([Year])),
InsertCalendarQtr á Table.AddColumn(InsertCalendarMonth, "QuarterInCalendar", cada "Q" & Number.ToText([QuarterOfYear]) & " " & Number.ToText([Year])),
InsertDayWeek ? Table.AddColumn(InsertCalendarQtr, "DayInWeek", each Date.DayOfWeek([Date])),
InsertDayName ? Table.AddColumn(InsertDayWeek, "DayOfWeekName", each Date.ToText([Date], "dddd"), escriba texto), escriba texto),
InsertWeekEnding ? Table.AddColumn(InsertDayName, "WeekEnding", each Date.EndOfWeek([Date]), tipo date),
InsertWeekNumberTM Table.AddColumn(InsertWeekEnding, "Week Number", each Date.WeekOfYear([Date])),
InsertMonthnYear á Table.AddColumn(InsertWeekNumber,"MonthnYear", cada [Año] * 10000 + [MonthOfYear] * 100),
InsertQuarternYear á Table.AddColumn(InsertMonthnYear,"QuarternYear", each [Year] * 10000 + [QuarterOfYear] * 100),
ChangedType1 ? Table.TransformColumnTypes(InsertQuarternYear,'QuarternYear", Int64.Type','Número de semana', Int64.Type','Año', escriba text','MonthnYear', Int64.Type, "DateInt", Int64.Type, "DayOfMonth", Int64.Type, "MonthOfYear", Int64.Type, "QuarterOfYear", Int64.Type, "MonthInCalendar", escriba text, "QuarterInCalendar", escriba text, "DayInWeek", Int64.Type,),
InsertShortYear á Table.AddColumn(ChangedType1, "ShortYear", each Text.End(Text.From([Year]), 2), texto de tipo),
AddFY - Table.AddColumn(InsertShortYear, "FY", cada "FY"&(if [MonthOfYear]>-FYStartMonth then Text.From(Number.From([ShortYear])+1) else [ShortYear]))
En
AddFY

consulta personalizada 2 (esto es lo que crea la tabla de fechas. Luego agregué una columna para comenzar la semana usando la fórmula en mi publicación original)

• Consulta1(#date(2019, 1, 1), #date(2025, 12, 31), 10)

@rachaelwalker no debería importar cómo creó la tabla de fechas? ¿Está abierto para enviar el archivo pbix, eliminar la información confidencial antes de compartir, si eso no es posible, entonces podemos tener una reunión de goto / llamada de zoom y mirar en él. Estaré disponible en una hora más o menos.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

¿A qué correo electrónico debo enviarlo?

@rachaelwalker no está seguro de si el último mensaje es para mí, se puede compartir por onedrive / Google drive enlace o enviarlo directamente, mi correo electrónico está en la firma.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Te envié un enlace a tu correo electrónico

@parry2k Gracias por tomarse el tiempo para resolver este problema. Agradecido fue una solución fácil y apreciar a todos los que se toman el tiempo.

Resolución: el campo Fecha de la tabla iauditor no se estableció en el tipo de datos "Fecha".

Hola @rachaelwalker ,

Puede cargar el ejemplo en OneDrive para la Empresa y compartir el vínculo aquí.

Por favor, no contenga ninguna Información Confidencial o Datos Reales en su respuesta.

Saludos

Equipo de apoyo a la comunidad _ zhenbw

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

rachaelwalker
Resolver III
Resolver III

2020-08-03 09_02_04-Technology Dashboard - Power BI Desktop.png

No estoy seguro de por qué mis capturas de pantalla desaparecieron del post original, pero aquí es para mostrar la relación

@rachaelwalker, espero que esto pueda ayudar

Cualquiera de los 7 días como inicio o fin de la semana

https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...

Mi suposición es tener tabla de fechas

Artículo súper útil! Pude agregar una columna a mi tabla de fechas para mostrar el lunes como la fecha de inicio de la semana. Son los objetos visuales/relación entre las tablas lo que me está dando problemas.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors