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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
vytas
Helper I
Helper I

Fechas mínimas/máximas

Hola

Tengo tabla virtual :

Facturas no pagadas ?

FILTRO (

ADDCOLUMNS (

RESUMIR (

Deuda;

Deuda[DocumentNr];

Deuda[CompanyNo];

Deuda[Día de Pago]

);

"Equilibrio"; CALCULATE (SUM (Deuda [Deuda]));

"InvoiceDate"; CALCULATE ( MAX ( Debt[InvoiceDate] ) )

);

[Saldo] > 0

)

El resultado es:

SaldoInvoiceDateDocumentNrCompanyNoDía de Pago
117.092020-02-1811258872020-05-28
44.042020-02-0521258872020-05-15
50.322020-04-2731258872020-01-08
90.052020-03-3141258872020-03-09
202.032020-04-2751258872020-01-14
442.252020-04-1661258872020-05-16
574.032020-04-1671258872020-05-16
167.672020-04-1681258872020-05-16
133.022020-04-1691258872020-05-16
110.22020-04-17101258872020-05-17
51.032020-04-20111258872020-05-20
149.762020-04-20121258872020-05-20
500.342020-04-20131258872020-05-20
45.512020-04-22141258872020-05-22
102.742020-04-22151258872020-05-22
102.532020-04-22161258872020-05-22
71.392020-04-22171258872020-05-22
67.272020-04-22181258872020-05-22
56.612020-04-23191258872020-05-23
169.822020-04-23201258872020-05-23
177.882020-04-23211258872020-05-23
1842020-04-23221258872020-05-23
34.252020-04-24231258872020-05-24
70.62020-04-28241258872020-05-28

¿Cómo podría escribir una medida que me da diferencia en días entre la fecha de factura máxima y mínima

3 REPLIES 3
Mariusz
Community Champion
Community Champion

Hola @vytas

Prueba algo como esto.

Measure = 
VAR __tbl =
    FILTER (
        ADDCOLUMNS (
            SUMMARIZE (
                Debt;
                Debt[DocumentNr];
                Debt[CompanyNo];
                Debt[PaymentDay]
            );
            "Saldo"; CALCULATE ( SUM ( Debt[Debt] ) );
            "InvoiceDate"; CALCULATE ( MAX ( Debt[InvoiceDate] ) )
        );
        [Saldo] > 0
    )
VAR __min = MINX( __tbl, [InvoiceDate] )
VAR __max = MAXX( __tbl, [InvoiceDate] )
RETURN 
    __max - __min 

Saludos
Mariusz

Si este post ayuda,entonces por favor considere aceptarlo como la solución.

Por favor, siéntase libre de conectarse conmigo.
Linkedin

Eso es lo que necesitaba. Encogiéndose de hombros hasta llegar a la fecha en la tabla virtual.

Acaba de envolver return en datediff.

Gracias.

amitchandak
Super User
Super User

@vytas , se puede obtener

Datediff(Min(Table[Date]),Max(Table[Date]),Day)

Consulte este blog sobre cómo usar el contexto de fila para obtener la diferencia de fecha correcta

https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Differ...

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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

Top Solution Authors