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
Syndicate_Admin
Administrator
Administrator

Filtrado de tickets abiertos en función de la fecha

Hola

Tengo una tabla llamada testdata que contiene tickets de soporte con un Id, Fecha abierta y Fecha de cierre como esta,

russgove2_0-1632520432838.png

Quiero crear un informe y graps para un período de tiempo seleccionado que muestre el número de tickets abiertos que existían antes del período de tiempo de la primera fecha, el número de tickets abiertos durante el período de tiempo, el número de tickets cerrados durante el período de tiempo y la cantidad de tickets que se dejaron abiertos después de que finalizó el período de tiempo.

Lo hice funcionar durante un período de tiempo de un solo día usando una tabla de fechas con estas columnas calcinadas agregadas:

TicketsIn = CALCULAR(
COUNTROWS(TestData),
FILTER(TestData,
(TestData[Opened_Date]<TestDates[Date] && ISBLANK(TestData[Closed_Date])
||
(TestData[Opened_Date]<TestDates[Date] && TestData[Closed_Date]>=TestDates[Date])
)))
TicketsOut = CALCULAR(
COUNTROWS(TestData),
FILTER(TestData,
(TestData[Opened_Date]<=TestDates[Date] && ISBLANK(TestData[Closed_Date])
||
(TestData[Opened_Date]<=TestDates[Date] && TestData[Closed_Date]>TestDates[Date])
)))
OpenedTickets = CALCULAR(
COUNTROWS(TestData),
FILTER(TestData,
(TestData[Opened_Date]=TestDates[Fecha]
)))
ClosedTickets = CALCULAR(
COUNTROWS(TestData),
FILTER(TestData,
(TestData[Closed_Date]=TestDates[Fecha]
)))
CurrentTickets = CALCULAR(
COUNTROWS(TestData),
FILTER(TestData,
(TestData[Opened_Date]<=TestDates[Date] && ISBLANK(TestData[Closed_Date])
||
(TestData[Opened_Date]<=TestDates[Date] && TestData[Closed_Date]>=TestDates[Date])
)))
Todos estos funcionan bien cuando la granularidad del informe es de un solo día:
russgove2_1-1632521049995.png

pero ahora quiero que estos se apliquen a un mes determinado, trimestre de año .../

Entiendo que necesito usar medidas en lugar de columnas calculadas para esto. Así que agregué una nueva medida a mey dates datble:

MTicketsIn = CALCULAR(
COUNTROWS(TestData),
FILTER(TestData,
(TestData[Opened_Date]<MIN(TestDates[Date].[ Fecha]) && ISBLANK(TestData[Closed_Date])
||
(TestData[Opened_Date]<MIN(TestDates[Date].[ Fecha]) && TestData[Closed_Date]>=MAX(TestDates[Date].[ Fecha])
))))
Pensé usando el MIN(TestDates[Date].[ Date]) y MAX(TestDates[Date].[ Fecha]) las funciones dentro del mismo cálculo que utilicé para fechas individuales funcionarían, pero solo muestra espacios en blanco.
Probé con FIRSTDATE y LASTDATE también, bit también muestra espacios en blanco.
Cualquiera recibió consejos sobre cómo hacer esto.
Se agradecerían enlaces a videos de Youtube o artículos sobre este tema.

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Hay @russgove2 ,

Pruebe las siguientes medidas:

MTicketsIn = 
CALCULATE (
    COUNTROWS ( TestData ),
    FILTER (
        TestData,
        (
            TestData[Opened_Date] < MIN ( TestDates[Date] )
                && ISBLANK ( TestData[Closed_Date] )
                || (
                    TestData[Opened_Date] < MIN ( TestDates[Date] )
                        && TestData[Closed_Date] >= MIN ( TestDates[Date] )
                )
        )
    )
)
MTicketsOut = 
CALCULATE (
    COUNTROWS ( TestData ),
    FILTER (
        TestData,
        (
            TestData[Opened_Date] <= MAX ( TestDates[Date] )
                && ISBLANK ( TestData[Closed_Date] )
                || (
                    TestData[Opened_Date] <= MAX ( TestDates[Date] )
                        && TestData[Closed_Date] > MAX ( TestDates[Date] )
                )
        )
    )
)
MCurrentTickets = 
CALCULATE (
    COUNTROWS ( TestData ),
    FILTER (
        TestData,
        (
            TestData[Opened_Date] <= MIN ( TestDates[Date] )
                && ISBLANK ( TestData[Closed_Date] )
                || (
                    TestData[Opened_Date] <= MIN ( TestDates[Date] )
                        && TestData[Closed_Date] >= MAX ( TestDates[Date] )
                )
        )
    )
)
MClosedTickets = 
CALCULATE (
    COUNTROWS ( TestData ),
    FILTER (
        TestData,
        (
            TestData[Closed_Date] >= MIN ( TestDates[Date] )
                && TestData[Closed_Date] <= MAX ( TestDates[Date] )
        )
    )
)

vkkfmsft_0-1632733770578.png

Si el problema aún no se resuelve, proporcione información detallada sobre el error o el resultado esperado que espera. Hágamelo saber de inmediato, esperando su respuesta.

Saludos
Winniz

Si esta publicación ayuda, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.

View solution in original post

7 REPLIES 7
Syndicate_Admin
Administrator
Administrator

Hay @russgove2 ,

Pruebe las siguientes medidas:

MTicketsIn = 
CALCULATE (
    COUNTROWS ( TestData ),
    FILTER (
        TestData,
        (
            TestData[Opened_Date] < MIN ( TestDates[Date] )
                && ISBLANK ( TestData[Closed_Date] )
                || (
                    TestData[Opened_Date] < MIN ( TestDates[Date] )
                        && TestData[Closed_Date] >= MIN ( TestDates[Date] )
                )
        )
    )
)
MTicketsOut = 
CALCULATE (
    COUNTROWS ( TestData ),
    FILTER (
        TestData,
        (
            TestData[Opened_Date] <= MAX ( TestDates[Date] )
                && ISBLANK ( TestData[Closed_Date] )
                || (
                    TestData[Opened_Date] <= MAX ( TestDates[Date] )
                        && TestData[Closed_Date] > MAX ( TestDates[Date] )
                )
        )
    )
)
MCurrentTickets = 
CALCULATE (
    COUNTROWS ( TestData ),
    FILTER (
        TestData,
        (
            TestData[Opened_Date] <= MIN ( TestDates[Date] )
                && ISBLANK ( TestData[Closed_Date] )
                || (
                    TestData[Opened_Date] <= MIN ( TestDates[Date] )
                        && TestData[Closed_Date] >= MAX ( TestDates[Date] )
                )
        )
    )
)
MClosedTickets = 
CALCULATE (
    COUNTROWS ( TestData ),
    FILTER (
        TestData,
        (
            TestData[Closed_Date] >= MIN ( TestDates[Date] )
                && TestData[Closed_Date] <= MAX ( TestDates[Date] )
        )
    )
)

vkkfmsft_0-1632733770578.png

Si el problema aún no se resuelve, proporcione información detallada sobre el error o el resultado esperado que espera. Hágamelo saber de inmediato, esperando su respuesta.

Saludos
Winniz

Si esta publicación ayuda, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.

Hola de nuevo!

Solo mirando esto de nuevo, el CurrentTickets se ve bien en la vista del día, pero en la vista del mes muestra que solo un boleto estuvo activo durante el mes. Hubiera pensado que mostraría que mostraría All 7 como activo para septiembre porque todas las entradas se abrieron en ese mes, así que (en caso de que alguien mire hacia atrás en esto) modifiqué los MCurrentTickets para que fueran

MCurrentTickets =
CALCULAR (
COUNTROWS ( TestData ),
FILTRO (
TestData,
(
Si estuvo abierto antes de este período y nunca se cerró
TestData[Opened_Date] <= MIN ( TestDates[Date] )
&& ISBLANK ( TestData[Closed_Date] )
||
Si se abrió o cerró en este período
(TestData[Opened_Date] <= MIN ( TestDates[Date] )
||
TestData[Opened_Date] <= MAX( TestDates[Date] )
)
)
))
Por lo tanto, sus boletos más boletos abiertos en un período: boletos actuales (cualquier boleto activo en el período) menos boletos cerrados = = boletos de salida.
aka.
BegininningBalance+additions=current/active
y current -closed =endingbalance

Doh

Después de haber releído mthat me doy cuenta de que no está bien, lo siento.

MCurrentTickets =
CALCULAR (
COUNTROWS ( TestData ),
FILTRO (
TestData,
(
Si estuvo abierto antes de este período y nunca se cerró
TestData[Opened_Date] <= MIN ( TestDates[Date] )
&& ISBLANK ( TestData[Closed_Date] )
||
Si se abrió en este período
(TestData[Opened_Date] >= MIN ( TestDates[Date] ) && TestData[Opened_Date] <= MAX ( TestDates[Date] ) )
||
Si se cerró en este período
(TestData[Closed_Date] >= MIN ( TestDates[Date] ) && TestData[Closed_Date] <= MAX ( TestDates[Date] ) )
)
)
)
Obras:
russgove2_0-1632863114341.png

Todos trabajan Genial, ¡Muchas gracias!

Así que mi muestra MticketsIn arriba estaba bastante cerca. Estaba usando TestDates[Date].[ Date} en lugar de solo TestDates[Date]

¿Qué hace TestDates[Date]. [Fecha] representar?

Syndicate_Admin
Administrator
Administrator

@russgove2 HI

Proporcione su archivo PBIX para que no tenga que volver a crear todos sus datos y medidas a mano.

Gracias

Phil

¿Cómo agrego un archivo adjunto aquí?

(Estoy probando las medidas proporcionadas por ahora)

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.

Top Kudoed Authors