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
Adri1
Frequent Visitor

Recuento de filtros creado, cerrado, cerrado a tiempo, boletos vencidos en una tabla de sumario de fecha por ubicación

Hola a todos,

Estoy strugeling para venir con una solución para construir un informe que muestra la tendencia de incidentes y acciones a lo largo del tiempo y ser capaz de filtrar este informe por ubicación. Puedo obtener los resultados que quiero creando una tabla de resumen y pocas medidas, pero mi problema es que no puedo filtrar esa tabla de resumen en función de la tabla de ubicaciones. Este es el ejemplo.

Tengo 3 tablas enlazadas entre sí a través de Location ID:

  1. Tabla de acción
  2. Tabla de ubicaciones
  3. Tabla de incidentes

Puesto que no hay acciones o incidentes necesarios para cada mes, estoy generando un nombre de tabla adicional Tabla de resumen que me permitirá mostrar la tendencia de la diferente caluclación durante cada período, incluso para el mes donde no hay incidentes ni acciones. Mi problema es cómo filtrar los resultados de esta tabla de resumen por la ubicación.

2020-07-01_06-53-11.png

Estas son mis medidas utilizadas en la tabla de resumen:

2020-07-01_07-39-52.png

Gracias de antemano por su apoyo
Adrien
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Ahí, @Adri1

Puede una tabla de fechas como se muestra a continuación. El archivo pbix se adjunta al final.

Calendar = CALENDARAUTO()

A continuación, puede crear medidas como se muestra a continuación.

Start Period = MIN('Calendar'[Date])

End Period = MAX('Calendar'[Date])

Incident = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result = 
CALCULATE(
    DISTINCTCOUNT(Incident[Incident ID]),
    FILTER(
        ALLSELECTED(Incident),
        Incident[Created On]>=startperiod&&
        Incident[Created On]<=endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

Created Action = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result = 
CALCULATE(
    DISTINCTCOUNT('Action'[Action ID]),
    FILTER(
            ALLSELECTED('Action'),
            'Action'[Created On]>=startperiod&&
            'Action'[Created On]<=endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

Closed Action = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result =  
CALCULATE(
    DISTINCTCOUNT('Action'[Action ID]),
    FILTER(
        ALLSELECTED('Action'),
        'Action'[Closed On]>=startperiod&&
        'Action'[Closed On]<=endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

Closed On Time Action = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result = 
CALCULATE(
    DISTINCTCOUNT('Action'[Action ID]),
    FILTER(
        ALLSELECTED('Action'),
        'Action'[Closed On]>=startperiod&&
        'Action'[Closed On]<=endperiod&&
        'Action'[Due On]>endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

Past Due Action = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result = 
CALCULATE(
    DISTINCTCOUNT('Action'[Action ID]),
    FILTER(
        ALLSELECTED('Action'),
        'Action'[Created On]>=startperiod&&
        'Action'[Calc Closed On]>endperiod&&
        'Action'[Due On]<endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

resultado:

g1.png

g2.png

Saludos

Allan

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

View solution in original post

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

Ahí, @Adri1

Puede una tabla de fechas como se muestra a continuación. El archivo pbix se adjunta al final.

Calendar = CALENDARAUTO()

A continuación, puede crear medidas como se muestra a continuación.

Start Period = MIN('Calendar'[Date])

End Period = MAX('Calendar'[Date])

Incident = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result = 
CALCULATE(
    DISTINCTCOUNT(Incident[Incident ID]),
    FILTER(
        ALLSELECTED(Incident),
        Incident[Created On]>=startperiod&&
        Incident[Created On]<=endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

Created Action = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result = 
CALCULATE(
    DISTINCTCOUNT('Action'[Action ID]),
    FILTER(
            ALLSELECTED('Action'),
            'Action'[Created On]>=startperiod&&
            'Action'[Created On]<=endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

Closed Action = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result =  
CALCULATE(
    DISTINCTCOUNT('Action'[Action ID]),
    FILTER(
        ALLSELECTED('Action'),
        'Action'[Closed On]>=startperiod&&
        'Action'[Closed On]<=endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

Closed On Time Action = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result = 
CALCULATE(
    DISTINCTCOUNT('Action'[Action ID]),
    FILTER(
        ALLSELECTED('Action'),
        'Action'[Closed On]>=startperiod&&
        'Action'[Closed On]<=endperiod&&
        'Action'[Due On]>endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

Past Due Action = 
var startperiod = [Start Period]
var endperiod = [End Period]
var result = 
CALCULATE(
    DISTINCTCOUNT('Action'[Action ID]),
    FILTER(
        ALLSELECTED('Action'),
        'Action'[Created On]>=startperiod&&
        'Action'[Calc Closed On]>endperiod&&
        'Action'[Due On]<endperiod
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

resultado:

g1.png

g2.png

Saludos

Allan

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

amitchandak
Super User
Super User

@Adri1 , Debe crear una tabla de fechas y se combinará con todas las fechas en dos tablas. Solo una relación estará activa en cada tabla.

El uso userelation para activar.

Refiera mi blog sobre temas similares

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

parry2k
Super User
Super User

@Adri1 le falta una tabla de dimensiones de fecha que es clave para todo esto. Como práctica recomendada, agregue la dimensión de fecha en el modelo y utilelo para los cálculos de inteligencia de tiempo y tiempo. Una vez agregada la dimensión de fecha, márquela como una tabla de fechas en las herramientas de tabla.

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

Aunque proporcionó mucha información, será más fácil si lanza algunos datos de ejemplo o pbix con datos de ejemplo y su salida esperada, ayudará a proporcionar una solución.

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 relacionados 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.

Adri1
Frequent Visitor

Gracias que funciona 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.