/build/static/layout/Breadcrumb_cap_w.png

Three month power saving report now only shows current month

I ran the 3 month power saving report.  Now only see July but not June and May.  Any Ideas?


0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: dugullett 11 years ago
Red Belt
3

I know this might be an obvious answer, but did you have the client installed in May and June?

This will give you all records created in the past month. Does this return anything?

select NAME, IP, USER, CREATED
FROM MACHINE
WHERE CREATED BETWEEN (ADDDATE(LAST_DAY(SUBDATE(NOW(), INTERVAL 2 MONTH)), INTERVAL 1 DAY))
AND LAST_DAY(SUBDATE(NOW(), INTERVAL 1 MONTH))
ORDER BY CREATED DESC
Posted by: SMal.tmcc 11 years ago
Red Belt
2

What changed a month ago?  Did you upgrade or export?  Did someone break the report on you?

Mine works

this is what is in the SQL box

SELECT NAME, MAC, CUR_MONTH, CUR_HOURS, PREV_MONTH_HOURS, PREV_MONTH2_HOURS,
    (PREV_MONTH_HOURS-CUR_HOURS) AS CUR_HOURS_SAVED,
    (PREV_MONTH_HOURS-CUR_HOURS)*150/1000 AS kWh_SAVED,
    (PREV_MONTH_HOURS-CUR_HOURS)*150/1000*.15 AS SAVED,
    (PREV_MONTH_HOURS-CUR_HOURS)/PREV_MONTH_HOURS*100 as CUR_PCT_SAVED,
    (PREV_MONTH2_HOURS-PREV_MONTH_HOURS) as PREV_HOURS_SAVED,
    (PREV_MONTH2_HOURS-PREV_MONTH_HOURS)*150/1000 as PREV_kWh_SAVED,
    (PREV_MONTH2_HOURS-PREV_MONTH_HOURS)*150/1000*.15 as PREV_SAVED,
    (PREV_MONTH2_HOURS-PREV_MONTH_HOURS)/PREV_MONTH2_HOURS*100 as PREV_PCT_SAVED
    FROM (SELECT NAME, MAC, DATE_FORMAT(NOW(), '%Y-%m') AS CUR_MONTH,

    (select AVG(HOURS)
    from MACHINE_DAILY_UPTIME MDU
    WHERE DAY > LAST_DAY(SUBDATE(NOW(), INTERVAL 1 MONTH))
    AND M.ID = MDU.MACHINE_ID
    ) AS CUR_HOURS,

    (select AVG(HOURS)
    from MACHINE_DAILY_UPTIME MDU
    WHERE DAY BETWEEN (ADDDATE(LAST_DAY(SUBDATE(NOW(), INTERVAL 2 MONTH)), INTERVAL 1 DAY)) AND LAST_DAY(SUBDATE(NOW(), INTERVAL 1 MONTH))
    AND M.ID = MDU.MACHINE_ID
    ) AS PREV_MONTH_HOURS,

    (select AVG(HOURS)
    from MACHINE_DAILY_UPTIME MDU
    WHERE DAY BETWEEN (ADDDATE(LAST_DAY(SUBDATE(NOW(), INTERVAL 3 MONTH)), INTERVAL 1 DAY)) AND LAST_DAY(SUBDATE(NOW(), INTERVAL 2 MONTH))
    AND M.ID = MDU.MACHINE_ID
    ) AS PREV_MONTH2_HOURS

    from MACHINE M
    WHERE M.CHASSIS_TYPE = 'desktop') AS AVERAGES
    ORDER BY NAME

 


Comments:
  • Wow Smal that's a big answer. Can you edit this and take the XML data out? It should not be his issue. The issue would be more in the query itself.

    WJ if you can post the query that are using? Unless it matches the default one and hasn't been edited. - dugullett 11 years ago
  • there you go. - SMal.tmcc 11 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ