Maximo Open Forum

 View Only
  • 1.  How to calculate percentage query in DB2

    Posted 09-16-2024 20:41

    Thanks site admin for this post.

    To all maximo expert out there,

    I have this query in DB2 that i cannot get the correct percentage. Can anyone help me on how to fix this?

     select siteid, count(*) total_tickets_count, sum(has_changed) proof_of_gatekeeping,(count(has_changed)/ count(*))*100 AS GATEKEEPING_PERCENTAGE
    from (
        select  sr.siteid,sr.ticketid,sr.status
                ,wo.wonum,wo.status
                ,case 
                    when sr.assetnum <> wo.assetnum then 1
                    when sr.location <> wo.location then 1
                    when sr.description <> wo.description then 1
                    when sr.OWNERGROUP <> wo.ownergroup then 1
    --                when sr.OWNERGROUP <> wo.persongroup then 1                
    --               when sr.REPORTEDPRIORITY <> wo.wopriority then 1
                    else 0
                 end as has_changed
        from maximo.ticket sr
        right join maximo.workorder wo ON wo.origrecordclass='SR' and wo.origrecordid=sr.ticketid
        where TO_CHAR(sr.reportdate, 'YYYY') = TO_CHAR(SYSDATE, 'YYYY') -- Year to Date condition
        and sr.class='SR'
       and sr.siteid IN ('XXXX')
    )
    group by siteid

    (proof / ticket_count)*100 = percentage  

    i am expecting any of these answer at least:

    appreciate any inputs.

    thanke again admin


    #Administration
    #Analytics
    #MaximoUserGroups

    ------------------------------
    Darwin Bagangan
    GNPOWER
    ------------------------------


  • 2.  RE: How to calculate percentage query in DB2

    Posted 09-17-2024 09:17

    The denominator should be a decimal value. Convert the denominator to a decimal value in your query 


    Select (248/3600.00)*100 from sysibm.sysdummy1;



    ------------------------------
    vineet joshi
    ------------------------------



  • 3.  RE: How to calculate percentage query in DB2

    Posted 09-17-2024 20:05

    thanks @vineet joshi. this solves my concern.

    thanks admin



    ------------------------------
    Darwin Bagangan
    GNPOWER
    ------------------------------



Featured Podcast
Episode 1 is live: IBM Maximo Application Suite 9.2

Watch or listen to Steven Shull and Phil Runion discuss the practical MAS 9.2 updates Maximo teams should know.

Watch the Podcast
MORE by Naviam Episode 1 cover
Watch the latest episode