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

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.

Reply
Tand81
Regular Visitor

Relleno agrupado por fechas

Hola.

Tengo un problema en la consulta de energía.

El primer colomn contiene información de pedido y el segundo colomns contiene Dates(first apperance is Date on stock and second is delivery to customer). ¿Cómo puedo completar las fechas entre estas dos fechas? He intentado fusionarme con una mesa de calender y rellenarla, pero no agrupa el relleno por órdenes, sólo hasta la próxima fecha.

image.png

Atentamente

Thomas

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hola, @Tand81

Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.

Mesa:

b1.png

Puede ir a 'Editor de consultas' e introducir los siguientes códigos en 'Advanced Editor'.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc7BCQAhDETRXnJW1ESdWIvYfxvu6i6I6C3M40NqJQFQ1MKTIXXi2PN7BmpmR/xoP9WYNVhNz5Qdx61dFNcWQxnndqr4S6zjrVDO8VROa9w6", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ORdPos = _t, Date = _t, Cont = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ORdPos", type text}, {"Date", type date}, {"Cont", Int64.Type}}),
    Custom2 = Table.AddColumn(#"Changed Type","RE",each 
let x=[ORdPos],y=[Date]
in 
Duration.Days( Table.Max(Table.SelectRows(#"Changed Type",each [ORdPos]=x),"Date")[Date]-y)
),
    Custom3 = Table.AddColumn(Custom2,"list",each let x=[RE] in List.Generate(()=>1,each _<=x,each _+1)),
    #"Expanded list" = Table.ExpandListColumn(Custom3, "list"),
    Custom4 = Table.AddColumn(#"Expanded list","NewDate",each if
[list]<>null then [Date]+#duration([list]-1,0,0,0) else [Date]),
    #"Removed Columns" = Table.RemoveColumns(Custom4,{"Date", "RE", "list"})
in
    #"Removed Columns"

Resultado:

b2.png

Saludos

Allan

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

amitchandak
Super User
Super User

@amitchandak Gracias.

Lo intenté, pero todavía no he logrado lo que estaba buscando.

No funcionó con este:

"CALCULATE(COUNTX(SUMMARIZE(filter(CROSSJOIN('Data';' DimDate');' DimDate'[Fecha] > 'Datos'[Fecha] && 'DimDate'[Fecha]<'Datos'[Fecha de envío]);' Data'[OrdPos];' DimDate'[Fecha]);' DimDate'[Fecha]))"

Funciona perfecto, gracias 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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