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
RichardFig1
Helper I
Helper I

Medida toma los datos de la última semana

Buenas tardes.

Espero me puedan ayudar. Estoy trabajando un reporte de tickets de soporte con una base de datos de SAP BW. Estoy usando la siguiente medida para calcular la cantidad de tickets activos por semana:

 

Active ticketsWK = CALCULATE(
DISTINCTCOUNT('CSM: Tickets PBI'[ID]),
FILTER(
'CSM: Tickets PBI',
('CSM: Tickets PBI'[WeekNum]<=MIN(_Calendario[weeknum])
)),
VALUES('CSM: Tickets PBI'[ID])) - CALCULATE(
DISTINCTCOUNT('CSM: Tickets PBI'[ID]),
FILTER('CSM: Tickets PBI',
('CSM: Tickets PBI'[Weekclose]<=MIN(_Calendario[weeknum]) && 'CSM: Tickets PBI'[Status]="6. Cerrado"
)),VALUES('CSM: Tickets PBI'[ID]))
 
El resultado parece estar bien, excepto que las semanas que no deben tener datos (semanas 1 al 17 y semanas 40 a 53) toman el dato de la última semana (semana 40). El objetivo es que sólo hayan datos desde la semana 18 hasta hoy.
RichardFig1_0-1632508294906.png

 

Cabe señalar, que la tabla de datos no está conectada a la tabla de calendario (por otra medida en el modelo). En su momento, traté de crear una segunda tabla de calendario y crear la relación, pero no funcionó.

 

 

Saludos,

Richard

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @RichardFig1 

Try this code.

Active ticketsWK =
CALCULATE (
    DISTINCTCOUNT ( 'CSM: Tickets PBI'[Número de operación.Número de operación Nivel 01] ),
    FILTER (
        'CSM: Tickets PBI',
        (
            'CSM: Tickets PBI'[WeekNum] <= MIN ( _Calendario[weeknum] )
                && MIN ( _Calendario[weeknum] ) IN VALUES ( 'CSM: Tickets PBI'[WeekNum] )
        )
    ),
    VALUES ( 'CSM: Tickets PBI'[Número de operación.Número de operación Nivel 01] )
)
    - CALCULATE (
        DISTINCTCOUNT ( 'CSM: Tickets PBI'[Número de operación.Número de operación Nivel 01] ),
        FILTER (
            'CSM: Tickets PBI',
            (
                'CSM: Tickets PBI'[Weekclose] <= MIN ( _Calendario[weeknum] )
                    && 'CSM: Tickets PBI'[Status INC.Status INC Nivel 01] = "6. Cerrado"
                    && MIN ( _Calendario[weeknum] ) IN VALUES ( 'CSM: Tickets PBI'[WeekNum] )
            )
        ),
        VALUES ( 'CSM: Tickets PBI'[Número de operación.Número de operación Nivel 01] )
    )

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-rzhou-msft
Community Support
Community Support

Hi @RichardFig1 

Try this code.

Active ticketsWK =
CALCULATE (
    DISTINCTCOUNT ( 'CSM: Tickets PBI'[Número de operación.Número de operación Nivel 01] ),
    FILTER (
        'CSM: Tickets PBI',
        (
            'CSM: Tickets PBI'[WeekNum] <= MIN ( _Calendario[weeknum] )
                && MIN ( _Calendario[weeknum] ) IN VALUES ( 'CSM: Tickets PBI'[WeekNum] )
        )
    ),
    VALUES ( 'CSM: Tickets PBI'[Número de operación.Número de operación Nivel 01] )
)
    - CALCULATE (
        DISTINCTCOUNT ( 'CSM: Tickets PBI'[Número de operación.Número de operación Nivel 01] ),
        FILTER (
            'CSM: Tickets PBI',
            (
                'CSM: Tickets PBI'[Weekclose] <= MIN ( _Calendario[weeknum] )
                    && 'CSM: Tickets PBI'[Status INC.Status INC Nivel 01] = "6. Cerrado"
                    && MIN ( _Calendario[weeknum] ) IN VALUES ( 'CSM: Tickets PBI'[WeekNum] )
            )
        ),
        VALUES ( 'CSM: Tickets PBI'[Número de operación.Número de operación Nivel 01] )
    )

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

RichardFig1
Helper I
Helper I

Pueden revisar si logran ingresar al siguiente link:

https://drive.google.com/file/d/1ivA6XXsb7mJkffOzVWTA5LXgqD-0awN0/view?usp=sharing

 

Saludos,

Richard

PaulDBrown
Community Champion
Community Champion

Puedes facilitarnos datos de muestra o un archivo PBIX y un ejemplo de los que esperas obtener?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Si, con mucho gusto. Cómo se hace en ese caso ya que por este medio no permite compartir el PBIX?

 

Saludos,

Lo más fácil es compartirlo desde Onedrive, Google Drive , Dropbox...





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Muchas gracias. En el siguiente link  de drive pueden descargar el pbix. La imagen compartida es el resultado esperado, pero realizado con otra fuente de datos. Mi objetivo es repolicarlo.

https://drive.google.com/drive/u/1/folders/11ulFi8IiR3lpGuahwp_qHOrqGUUSiRF7

 

Saludos,

Hi @RichardFig1 

I don't have access to this pbix file you shared. I see three columns in the table visual in your screenshot, Week, Nuevos and Active ticketWK. Is Active ticketWK the distinct count of the Nuevos? How did you get Nuevos column, is it sum of the column? I think you can try distinct count function in value field.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.