- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Diferencia entre fechas en número de semanas
Hola
Estoy tratando de plantear un informe simple que muestra el número de semanas entre dos fechas, no he sido capaz de encontrar cómo hacerlo, ¿podría alguien por favor ayudar.
Sólo una tercera columna que muestra el número de semanas con 1 como mínimo es todo lo que necesito.
Gracias
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hola @T_Francis
puede hacerlo dentro de Power Query de la siguiente manera:
// Table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dZBRCsAgDEPv4rfQtHVzO4t4/2usCs4q+BmeaRJLCZKIQQLmEIPiFzWWgIsgTcKYgSE6E8eECfdk8hJ4MPews+yZ+dTdVH9TV9/jfHsX9j0tPB0Y9Oxrxd6TL5+3b/uWDVvesl023/LXM7zWDw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"HCT START DATE" = _t, #"HCT PLANNED END DATE" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"HCT START DATE", type date}, {"HCT PLANNED END DATE", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "# of Weeks", each Number.RoundUp(Number.From([HCT PLANNED END DATE] - [HCT START DATE]) / 7,0)),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"# of Weeks", Int64.Type}})
in
#"Changed Type1"
Saludos FrankAT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Gracias por responder, pero de esta manera envía un mensaje de error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

todavía parece una columna personalizada para la interfaz de Power Query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Use los botones de transformación de la cinta de opciones, vea cómo lo hice.
let
Source = Excel.CurrentWorkbook(){[Name = "Table23"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(
Source,
{{"Date", type date}, {"Other Date", type date}}
),
#"Inserted Date Subtraction" = Table.AddColumn(
#"Changed Type",
"Subtraction",
each Duration.Days([Other Date] - [Date]),
Int64.Type
),
#"Divided Column" = Table.TransformColumns(
#"Inserted Date Subtraction",
{{"Subtraction", each _ / 7, type number}}
),
#"Rounded Up" = Table.TransformColumns(
#"Divided Column",
{{"Subtraction", Number.RoundUp, Int64.Type}}
)
in
#"Rounded Up"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Lo que el error sería sería útil, que sólo dice que el error no es demasiado útil
Si usted está deseando que muestre 1 semana para 1-7 días, 2 semanas para 8-14 días, etc,entonces este es realmente un caso simple de encontrar la diferencia en días, dividiendo por 7, luego usando Number.RoundUp (si usa Power Query) o ROUNDUP (en DAX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@T_Francis puede agregar una nueva columna usando dax
Number of Weeks = MIN ( DATEDIFF ( Table[Start Date], Table[End Dat], WEEK ), 1 )
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Gracias
La fórmula no parece estar funcionando
¿Estoy cometiendo un error en alguna parte?
Necesito usar el resultado en una hoja de cálculo, así que ¿hay una manera de hacerlo en la consulta de energía o tengo que crear una medida?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
05-29-2024 12:39 PM | |||
03-11-2024 04:04 PM | |||
07-20-2024 10:44 PM | |||
06-28-2023 07:10 AM | |||
03-17-2021 08:16 PM |
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |