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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
shompy08
Frequent Visitor

Calculo de disponibilidad mantenimiento

Estimados, buenos días, necesito ayuda con un cálculo para el area de mantenimiento.

 

Por un lado tengo esta tabla donde mes a mes voy completando el tiempo de operacion necesario de distintas plantas.

MesPlanta 1Planta 2Planta 3Planta n..

Enero

10 Hs11 Hs9 Hs14 Hs
Febrero12 Hs13 Hs12 Hs10 Hs
Noviembre13 Hs15 Hs8 Hs13 Hs
Diciembre14 Hs17 Hs5 Hs14 Hs

 

Por otro lado, tengo una tabla donde descargo los tiempos fuera de servicio de cada equipo que forman parte de cada planta:

 

AvisoEquipoPlantaFechaTiempo fuera de servicio(en Horas)
11Planta 101/01/2022             4
22Planta 101/01/2022             2
33Planta 201/02/2022             150
44Planta 301/12/2022             10

 

Lo que necesito es sacar el % de tiempo disponible de cada equipo realizando la operacion ((Tiempo necesario Enero Planta 1 - Tiempo fuera de servicio Equipo Planta 1)/ Tiempo necesario Enero Planta 1)

 

En el ejemplo 1 sería ((10-4)/10).

 

Esto tengo que hacerlo para cada equipo en cada mes del año para poder publicar una tabla con todos aquellos cuyo % disponibilidad sea menor a 90%.

 

Me podrían ayudar a poder resolverlo? Muchas gracias!

2 ACCEPTED SOLUTIONS
v-yanjiang-msft
Community Support
Community Support

Hi @shompy08 ,

According to your description, here's my solution.

1.In Power Query, select all Floor columns at the same time(Ctrl+select).

vkalyjmsft_0-1644215478408.png

2.Click Unpivot Columns tab under Transform ribbon.

vkalyjmsft_1-1644215537478.png

3.Then select Extract Text Before Delimiter, enter a space in the Delimiter box.

vkalyjmsft_2-1644215781461.png

vkalyjmsft_3-1644215822424.png

Get this table.

vkalyjmsft_4-1644216210915.png

4.In another table2, create a calculated column Month.

Month = FORMAT('Table2'[Date],"MMMM")

vkalyjmsft_5-1644216259262.png

5.Create a measure.

% availability =
VAR _TimeNeeded =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Month] = MAX ( 'Table2'[Month] )
                && 'Table'[Plant] = MAX ( 'Table2'[Plant] )
        ),
        'Table'[Hours]
    )
RETURN
    DIVIDE (
        _TimeNeeded - MAX ( 'Table2'[Time out of service (in Hours)] ),
        _TimeNeeded
    )

Get the result. You can apply the visual filter to get % avaliability less than 90%.

vkalyjmsft_8-1644216509166.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

 

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

Hi @shompy08 ,

Yes, you can modify the formula like this:

% availability =
VAR _TimeNeeded =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Month] = MAX ( 'Table2'[Month] )
                && 'Table'[Plant] = MAX ( 'Table2'[Plant] )
        ),
        'Table'[Hours]
    )
VAR _DIVIDE =
    DIVIDE (
        _TimeNeeded - MAX ( 'Table2'[Time out of service (in Hours)] ),
        _TimeNeeded
    )
RETURN
    IF ( _DIVIDE < 0, 0_DIVIDE )

Best Regards,
Community Support Team _ kalyj

View solution in original post

13 REPLIES 13
shompy08
Frequent Visitor

Did you understand my question? 

Hi @shompy08 ,

Sorry I'm not very clear about your problem, are you convenient to share your pbix file without sensitive information here? 

Best Regards,
Community Support Team _ kalyj

I created a new file with some of the data. There is the .pbix.

In the page 1 (calculated) is how is now. In the page 2 (ideal) is what i need. Not just include the equipment that had a notifications (p1), if some equipment didn't have a notification it's understood that it had a 100% of availability in the month and i need to show them in the list. Example.pbix 

Hi @shompy08 ,

I modify the formula like this:

Cálculo disponibilidad = 
VAR _TimeNeeded =
    MAXX (
        FILTER (
            ALL ( 'Tiempo de necesidad' ),
            'Tiempo de necesidad'[Mes] = MAX ( Notifications[Mes parada])
                && 'Tiempo de necesidad'[Planta] = MAX ( Notifications[Planta] )
        ),
        'Tiempo de necesidad'[Valor]
    )
VAR _DIVIDE =
    DIVIDE (
        _TimeNeeded - MAX ( Notifications[Duración parada] ),
        _TimeNeeded
    )
RETURN
    IF ( _DIVIDE < 0, 0,IF(_TimeNeeded=BLANK(),1,_DIVIDE))

I attach the sample below for reference.

Best Regards,

Kaly

Kaly, thanks for your help, you are very kind!

 

There is some mistake because the list is showing incorrect information. If you see in the example that you attached, every "Equipo" is repeated three times,  one for every plant, which is incorrect.

 

shompy08_0-1645801543418.png

If i want to show my boss a list of the "Equipos" for every plant and its calculate, it show all the equipments! I suppose this happen to with the dates by month.

And if you see the data, the code 3001045 belongs to "Toyota Hilux..." not to "Bomba Allweiler" as in the picture you can see.

 

shompy08_1-1645801855806.png

 

Did i explain the error?

 

Thanks again for all you help!

Hi @shompy08 ,

I'm clear, for the current report, the problem can be solved by selecting the Planta column in the Notifications table, not in the Plants-Locations table.

vkalyjmsft_0-1646042632387.png

vkalyjmsft_1-1646042769294.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

 

Dear Kaly, im affraid that is not correct!

 

If you see in the img and in the report, there are some equipments from another plants showed when the filter CVSA is activated.

 

shompy08_1-1646220274400.png

 

Even, if you select another plant, the information showed in the table is the same, not change.

 

did i explain what i'm seeing?

 

Regards!

 

Hi @shompy08 ,

Yes, the measure always can't be filtered by the slicer, I think it's because the formula " IF(_TimeNeeded=BLANK(),1", it makes all options have a value always. In order to make blank lines return 1, I use other formulas, but can't be filtered by the slicer also. Without this condition, everything works fine.

Best Regards,
Community Support Team _ kalyj

Ok, thanks very much Kaly. I guess i will need to duplicate the table just for show the "NO OK" values and kepp one to all the values.!

 

Greetings!

shompy08
Frequent Visitor

Dear, i have a little problem with the report.

 

When i publish in a table, i can't see all the equipments asociated with each plant. I suppose this happen because this equipment doesn't had a breakdown report (table 2) in the month but its works all the time that the plant need. (Hours needed)

If the equipment doesn't have a a report it has to appear in the table with 100% availability. Do you know how i can see this?

Here is an a example, in the left, the table has the formula for equipments of "PETN" plant that you show me, in the right, part of the full list of equipment for the "PETN" plant.

image.png

Did explain my problem? I need that the table showme the full list with the %, 100% if there was not breakdowns, and n% if the equipment had a breakdown in the month.

 

Thx in advance!

shompy08
Frequent Visitor

Thx! you saved me! i made some small modifications cause the idea was different but it works!

 

There is any way to make negative values in 0? i mean, if the result is -75,2 % For ex, can use something to indicate just 0 in the formula?

Hi @shompy08 ,

Yes, you can modify the formula like this:

% availability =
VAR _TimeNeeded =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Month] = MAX ( 'Table2'[Month] )
                && 'Table'[Plant] = MAX ( 'Table2'[Plant] )
        ),
        'Table'[Hours]
    )
VAR _DIVIDE =
    DIVIDE (
        _TimeNeeded - MAX ( 'Table2'[Time out of service (in Hours)] ),
        _TimeNeeded
    )
RETURN
    IF ( _DIVIDE < 0, 0_DIVIDE )

Best Regards,
Community Support Team _ kalyj

v-yanjiang-msft
Community Support
Community Support

Hi @shompy08 ,

According to your description, here's my solution.

1.In Power Query, select all Floor columns at the same time(Ctrl+select).

vkalyjmsft_0-1644215478408.png

2.Click Unpivot Columns tab under Transform ribbon.

vkalyjmsft_1-1644215537478.png

3.Then select Extract Text Before Delimiter, enter a space in the Delimiter box.

vkalyjmsft_2-1644215781461.png

vkalyjmsft_3-1644215822424.png

Get this table.

vkalyjmsft_4-1644216210915.png

4.In another table2, create a calculated column Month.

Month = FORMAT('Table2'[Date],"MMMM")

vkalyjmsft_5-1644216259262.png

5.Create a measure.

% availability =
VAR _TimeNeeded =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Month] = MAX ( 'Table2'[Month] )
                && 'Table'[Plant] = MAX ( 'Table2'[Plant] )
        ),
        'Table'[Hours]
    )
RETURN
    DIVIDE (
        _TimeNeeded - MAX ( 'Table2'[Time out of service (in Hours)] ),
        _TimeNeeded
    )

Get the result. You can apply the visual filter to get % avaliability less than 90%.

vkalyjmsft_8-1644216509166.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

 

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

 

Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.