Analista de Dados e BI

Working for Agro Locks

Eduardo Ladeira Guimarães

Atuo com Business Intelligence e análise de dados, desde a construção das consultas e consolidação dos dados em diferentes bancos (SQL Server, PostgreSQL, SAP HANA e Firebird) até o desenvolvimento de dashboards completos em Power BI com SQL, DAX e Power Query. Meu trabalho conecta operações, finanças, logística e tecnologia da informação por meio de indicadores que ajudam equipes a acompanhar desempenho, identificar desvios e tomar decisões com mais segurança.

Ver projetos
Power BIDAXPower QuerySQL DatabasesPostgreSQLFirebirdAWS AthenaAI + MCPBI AutomationData Modeling
Avatar 3D de Eduardo com notebook

Trabalhos Selecionados

Dashboards & Dados

Projetos que conectam dashboards e consultas em cada análise.

1-2 / 8

Power BI / TI

Fluxo de Chamados

-- Project: IT SLA Dashboard
-- Description: SQL queries used for SLA analysis, runtime evaluation, and satisfaction metrics.

-- 1. Main Ticket Workflow Extraction
-- Description: Retrieves latest version of service requests and links workflow + assignment data.

SELECT 
    wf.process_id,
    req.requester_name,
    req.ticket_type,
    req.ticket_title,
    wf.workflow_status,
    req.business_unit,
    ISNULL(assignee.analyst_id, 'Waiting for Assignment') AS analyst_id,
    COALESCE(assignee.assignment_start_date, wf.process_start_date) AS start_date,
    assignee.assignment_end_date,
    assignee.total_runtime,
    req.priority,
    req.system_name,
    req.service_category,
    req.incident_category,
    req.incident_justification,
    req.is_project_related,
    req.waiting_for_third_party,
    req.corrective_reason,
    req.access_type,
    req.purchase_type,
    req.purchase_item,
    req.access_issue_type,
    req.unavailable_resource,
    req.installation_reason,
    req.maintenance_type,
    req.billing_impact,
    req.project_name
FROM service_requests req
INNER JOIN (
    SELECT 
        document_id, 
        MAX(version_number) AS latest_version
    FROM service_requests
    GROUP BY document_id
) latest_req 
    ON req.document_id = latest_req.document_id
   AND req.version_number = latest_req.latest_version
INNER JOIN workflow_processes wf
    ON wf.request_document_id = req.document_id
LEFT JOIN (
    SELECT 
        t.process_id,
        t.analyst_id,
        t.assignment_start_date,
        t.assignment_end_date,
        t.total_runtime
    FROM workflow_tasks t
    INNER JOIN (
        SELECT 
            process_id,
            MAX(task_sequence) AS latest_task_sequence
        FROM workflow_tasks
        WHERE analyst_id IN (
            'analyst_01',
            'analyst_02',
            'analyst_03',
            'analyst_04',
            'analyst_05'
        )
        AND analyst_id NOT IN ('system_auto')
        AND analyst_id NOT LIKE 'queue%'
        AND (
            task_notes IS NULL
            OR task_notes = ''
            OR task_notes NOT LIKE '%Task automatically assigned%'
        )
        GROUP BY process_id
    ) latest_task
        ON t.process_id = latest_task.process_id
       AND t.task_sequence = latest_task.latest_task_sequence
    WHERE t.analyst_id IN (
        'analyst_01',
        'analyst_02',
        'analyst_03',
        'analyst_04',
        'analyst_05'
    )
    AND t.analyst_id NOT IN ('system_auto')
    AND t.analyst_id NOT LIKE 'queue%'
    AND (
        t.task_notes IS NULL
        OR t.task_notes = ''
        OR t.task_notes NOT LIKE '%Task automatically assigned%'
    )
) assignee
    ON assignee.process_id = wf.process_id
WHERE wf.workflow_status IN ('Open', 'Completed');



-- 2. Runtime Analysis for IT Tickets
-- Description: Identifies tickets with high resolution time

SELECT
    t.process_id,
    t.analyst_id,
    t.total_runtime,
    wf.process_start_date
FROM workflow_tasks t
INNER JOIN workflow_processes wf
    ON wf.process_id = t.process_id
INNER JOIN service_requests req
    ON req.process_id = t.process_id
WHERE 
    t.analyst_id NOT IN ('system_auto')
    AND wf.process_type = 'IT_Request'
    AND t.analyst_id IN (
        'analyst_01',
        'analyst_02',
        'analyst_03',
        'analyst_04',
        'analyst_05'
    )
    AND t.analyst_id NOT LIKE 'queue%'
    AND wf.process_start_date >= '2025-01-01'
    AND wf.workflow_status = 'Completed'
    AND t.total_runtime >= 200
    AND req.waiting_for_third_party <> 'yes'
    AND req.is_project_related <> 'yes'
ORDER BY
    t.process_id,
    t.task_sequence;



-- 3. Closed Ticket Satisfaction Analysis
-- Description: Extracts satisfaction survey responses for completed IT tickets

SELECT
    req.process_id,
    req.requester_name,
    req.ticket_status,
    req.business_unit,
    req.ticket_type,
    req.analyst_service_rating,
    req.service_satisfaction,
    req.communication_clarity_rating,
    req.solution_effectiveness_rating,
    wf.workflow_status
FROM service_requests req
INNER JOIN (
    SELECT 
        document_id,
        MAX(version_number) AS latest_version
    FROM service_requests
    GROUP BY document_id
) latest_req
    ON req.document_id = latest_req.document_id
   AND req.version_number = latest_req.latest_version
INNER JOIN workflow_processes wf
    ON wf.request_document_id = req.document_id
WHERE wf.workflow_status = 'Completed'
  AND req.ticket_type IN ('Access', 'System', 'Infrastructure', 'Data')
  AND (
        req.analyst_service_rating <> 'Not Answered'
        OR req.service_satisfaction <> 'Not Answered'
      );

Power BI / Operations

Pesagem Manual

-- Project: Manual Weighing Control Dashboard
-- Description: SQL queries used to monitor manual truck weighing operations,
-- including approval flow, operational delays, and recurring manual weighing scenarios.

-- 1. Manual Weighing Records (With Integration Filters)

SELECT
    w.load_number,
    CASE w.direction_type
        WHEN 'OUT' THEN 'Outbound'
        WHEN 'IN' THEN 'Inbound'
        ELSE 'Not Informed'
    END AS direction,
    w.is_first_weighing_manual,
    w.is_second_weighing_manual,
    p.product_name,
    approval.approver_name,
    approval.manual_reason,
    b.business_unit_name,
    CONVERT(DATE, DATEADD(HOUR, -1,
        CASE
            WHEN w.is_second_weighing_manual = '1' THEN w.second_weighing_datetime
            ELSE w.first_weighing_datetime
        END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS weighing_date,
    CONVERT(TIME, DATEADD(HOUR, -1,
        CASE
            WHEN w.is_second_weighing_manual = '1' THEN w.second_weighing_datetime
            ELSE w.first_weighing_datetime
        END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS weighing_time,
    CONVERT(DATE, DATEADD(HOUR, -1,
        CASE
            WHEN w.is_second_weighing_manual = '1' THEN w.second_approval_datetime
            ELSE w.first_approval_datetime
        END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS approval_date,
    CONVERT(TIME, DATEADD(HOUR, -1,
        CASE
            WHEN w.is_second_weighing_manual = '1' THEN w.second_approval_datetime
            ELSE w.first_approval_datetime
        END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS approval_time,
    DATEDIFF(MINUTE,
        DATEADD(HOUR, -1,
            CASE
                WHEN w.is_second_weighing_manual = '1' THEN w.second_weighing_datetime
                ELSE w.first_weighing_datetime
            END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
        ),
        DATEADD(HOUR, -1,
            CASE
                WHEN w.is_second_weighing_manual = '1' THEN w.second_approval_datetime
                ELSE w.first_approval_datetime
            END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
        )
    ) AS approval_time_minutes
FROM truck_weighing w
LEFT JOIN business_units b ON b.business_unit_id = w.business_unit_id
LEFT JOIN users u1 ON u1.user_id = w.first_approval_user_id
LEFT JOIN users u2 ON u2.user_id = w.second_approval_user_id
LEFT JOIN products p ON p.product_id = w.product_id
OUTER APPLY (
    SELECT u1.user_name AS approver_name, w.first_manual_reason AS manual_reason
    WHERE w.first_approval_user_id IS NOT NULL

    UNION ALL

    SELECT u2.user_name AS approver_name, w.second_manual_reason AS manual_reason
    WHERE w.second_approval_user_id IS NOT NULL
) approval
WHERE '1' IN (w.is_first_weighing_manual, w.is_second_weighing_manual)
  AND w.deleted_at IS NULL
  AND w.status_code = 'COMPLETED'
  AND w.erp_document IS NOT NULL
  AND (
        w.first_approval_user_id IS NOT NULL
        OR w.second_approval_user_id IS NOT NULL
      )

-- 2. Manual Weighing Records (Without Integration Filters)

SELECT
    w.load_number,
    CASE w.direction_type
        WHEN 'OUT' THEN 'Outbound'
        WHEN 'IN' THEN 'Inbound'
        ELSE 'Not Informed'
    END AS direction,
    w.is_first_weighing_manual,
    w.is_second_weighing_manual,
    p.product_name,
    approval.approver_name,
    approval.manual_reason,
    b.business_unit_name,
    CONVERT(DATE, DATEADD(HOUR, -1,
        CASE
            WHEN w.is_second_weighing_manual = '1' THEN w.second_weighing_datetime
            ELSE w.first_weighing_datetime
        END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS weighing_date,
    CONVERT(TIME, DATEADD(HOUR, -1,
        CASE
            WHEN w.is_second_weighing_manual = '1' THEN w.second_weighing_datetime
            ELSE w.first_weighing_datetime
        END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS weighing_time,
    CONVERT(DATE, DATEADD(HOUR, -1,
        CASE
            WHEN w.is_second_weighing_manual = '1' THEN w.second_approval_datetime
            ELSE w.first_approval_datetime
        END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS approval_date,
    CONVERT(TIME, DATEADD(HOUR, -1,
        CASE
            WHEN w.is_second_weighing_manual = '1' THEN w.second_approval_datetime
            ELSE w.first_approval_datetime
        END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS approval_time,
    DATEDIFF(MINUTE,
        DATEADD(HOUR, -1,
            CASE
                WHEN w.is_second_weighing_manual = '1' THEN w.second_weighing_datetime
                ELSE w.first_weighing_datetime
            END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
        ),
        DATEADD(HOUR, -1,
            CASE
                WHEN w.is_second_weighing_manual = '1' THEN w.second_approval_datetime
                ELSE w.first_approval_datetime
            END AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
        )
    ) AS approval_time_minutes
FROM truck_weighing w
LEFT JOIN business_units b ON b.business_unit_id = w.business_unit_id
LEFT JOIN users u1 ON u1.user_id = w.first_approval_user_id
LEFT JOIN users u2 ON u2.user_id = w.second_approval_user_id
LEFT JOIN products p ON p.product_id = w.product_id
OUTER APPLY (
    SELECT u1.user_name AS approver_name, w.first_manual_reason AS manual_reason
    WHERE w.first_approval_user_id IS NOT NULL

    UNION ALL

    SELECT u2.user_name AS approver_name, w.second_manual_reason AS manual_reason
    WHERE w.second_approval_user_id IS NOT NULL
) approval
WHERE '1' IN (w.is_first_weighing_manual, w.is_second_weighing_manual)
  AND w.deleted_at IS NULL
  AND w.status_code = 'COMPLETED'
  AND (
        w.first_approval_user_id IS NOT NULL
        OR w.second_approval_user_id IS NOT NULL
      )

-- 3. Manual Weighing Operational Details

SELECT
    w.load_number,
    CASE w.direction_type
        WHEN 'OUT' THEN 'Outbound'
        WHEN 'IN' THEN 'Inbound'
        ELSE 'Not Informed'
    END AS direction,
    unified.operator_name,
    unified.product_name,
    w.is_first_weighing_manual AS first_weighing_manual,
    w.is_second_weighing_manual AS second_weighing_manual,
    unified.business_unit_name,
    CONVERT(DATE, DATEADD(HOUR, -1,
        w.first_weighing_datetime AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS first_weighing_date,
    CONVERT(TIME, DATEADD(HOUR, -1,
        w.first_weighing_datetime AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS first_weighing_time,
    CONVERT(DATE, DATEADD(HOUR, -1,
        w.second_weighing_datetime AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS second_weighing_date,
    CONVERT(TIME, DATEADD(HOUR, -1,
        w.second_weighing_datetime AT TIME ZONE 'UTC' AT TIME ZONE 'E. South America Standard Time'
    )) AS second_weighing_time
FROM truck_weighing w
LEFT JOIN business_units b ON b.business_unit_id = w.business_unit_id
LEFT JOIN users u1 ON u1.user_id = w.first_weighing_user_id
LEFT JOIN users u2 ON u2.user_id = w.second_weighing_user_id
LEFT JOIN products p ON p.product_id = w.product_id
OUTER APPLY (
    SELECT u1.user_name AS operator_name, b.business_unit_name, p.product_name
    WHERE w.first_weighing_user_id IS NOT NULL
      AND w.first_weighing_user_id <> w.second_weighing_user_id

    UNION ALL

    SELECT u2.user_name AS operator_name, NULL, NULL
    WHERE w.second_weighing_user_id IS NOT NULL
      AND w.first_weighing_user_id <> w.second_weighing_user_id

    UNION ALL

    SELECT u2.user_name AS operator_name, b.business_unit_name, p.product_name
    WHERE w.second_weighing_user_id IS NOT NULL
      AND (
            w.first_weighing_user_id = w.second_weighing_user_id
            OR w.first_weighing_user_id IS NULL
          )
) unified
WHERE w.deleted_at IS NULL
  AND w.status_code = 'COMPLETED'
ORDER BY w.first_weighing_datetime DESC;