{"id":1014,"date":"2017-02-27T11:33:51","date_gmt":"2017-02-27T02:33:51","guid":{"rendered":"http:\/\/okamurax.com\/?p=1014"},"modified":"2024-05-04T11:12:29","modified_gmt":"2024-05-04T02:12:29","slug":"%e7%b5%b1%e8%a8%88%e9%96%a2%e9%80%a3%e5%9f%ba%e7%a4%8e-%e6%a8%99%e6%ba%96%e5%81%8f%e5%b7%ae%e3%80%81%e7%9b%b8%e9%96%a2%e4%bf%82%e6%95%b0%e3%80%81%e7%b7%9a%e5%bd%a2%e5%9b%9e%e5%b8%b0","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=1014","title":{"rendered":"Excel \u6a19\u6e96\u504f\u5dee\u3001\u76f8\u95a2\u4fc2\u6570\u3001\u7dda\u5f62\u56de\u5e30"},"content":{"rendered":"<p>\u6a19\u6e96\u504f\u5dee\u3001\u76f8\u95a2\u4fc2\u6570\u3001\u7dda\u5f62\u56de\u5e30\u306e\u6c42\u3081\u65b9\u3002<br \/>\n\u624b\u52d5\u8a08\u7b97\u3068\u30a8\u30af\u30bb\u30eb\u95a2\u6570\u3092\u4f7f\u3063\u305f\u5834\u5408\u3002<\/p>\n<p><iframe loading=\"lazy\" width=\"700\" height=\"900\" src=\"https:\/\/docs.google.com\/spreadsheets\/d\/e\/2PACX-1vT8VSKwUGCHlG8uVFXqV4643vF2G0qDgfMFnTNY9EpgUIPVuD7mAArWK7zpDZY6XA\/pubhtml?widget=true&amp;headers=false\"><\/iframe><\/p>\n<h2>\u5206\u6790\u57fa\u790e<\/h2>\n<p>\u30fb\u57fa\u672c<\/p>\n<p>\u7d50\u8ad6\u306f\u91d1\u984d\u63db\u7b97\u3057\u3066\u5206\u304b\u308a\u3084\u3059\u304f\u3002\u7d99\u7d9a\u89b3\u5bdf\u3057\u3066\u3044\u304f\u306a\u3089KPI\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<p>\u30fb\u30b5\u30f3\u30d7\u30eb\u306e\u4e2d\u3067\u5909\u6570\u306b\u5c5e\u6027\u3092\u8ffd\u52a0\u3002<\/p>\n<p>\u4f8b)<br \/>\n\u6765\u5e97\u7387\u304c\u4e0b\u304c\u3063\u3066\u3044\u308b\u9867\u5ba2\u3001\u4e0a\u304c\u3063\u3066\u3044\u308b\u9867\u5ba2\u3001\u7279\u5b9a\u306e\u6642\u671f\u306b\u4e0a\u304c\u308b\u9867\u5ba2\u7b49\u3002<br \/>\n\u8cfc\u5165\u91d1\u984d\u304c\u9ad8\u3044\u9867\u5ba2(A\u30e9\u30f3\u30af)\u3001\u4f4e\u3044\u9867\u5ba2(B\u30e9\u30f3\u30af)\u306a\u3069\u3002<\/p>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u9867\u5ba2\u306e\u30cb\u30fc\u30ba\u306e\u4eee\u8aac\u3084\u3001\u5206\u6790\u304b\u3089\u6392\u9664\u306e\u5fc5\u8981\u6027\u7b49\u3092\u691c\u8a0e\u3059\u308b\u3002<\/p>\n<p>\u30fb\u6b21\u306b\u4ed6\u306e\u30b5\u30f3\u30d7\u30eb\u3068\u6bd4\u8f03\u3002<\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\uff11(\u4f1a\u54e1\u7b49)\u3067\u306e\u7279\u5fb4(\u6a19\u6e96\u504f\u5dee\u3084\u4e2d\u592e\u5024\u7b49)\u304c\u30b5\u30f3\u30d7\u30eb\uff12(\u975e\u4f1a\u54e1\u7b49)\u3068\u6bd4\u8f03\u3057\u3066\u3069\u3046\u9055\u3046\u304b\u3002\u305d\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u30b5\u30f3\u30d7\u30eb\uff11\u306f\u30b5\u30f3\u30d7\u30eb\uff12\u3068\u6bd4\u3079\u3066\u306f\u3069\u306e\u3088\u3046\u306a\u7279\u5fb4\u304c\u3042\u308b\u306e\u304b\u5206\u304b\u308b\u3002<\/p>\n<p>\u30fb\u8907\u6570\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306e\u6bd4\u8f03<\/p>\n<p>\u4f1a\u54e1\u3068\u5546\u54c1\u306e\u95a2\u4fc2\u3067\u306e\u7279\u5fb4\u306f\u3001\u975e\u4f1a\u54e1\u3068\u5546\u54c1\u306e\u95a2\u4fc2\u3068\u6bd4\u8f03\u3057\u3066\u3069\u3046\u9055\u3046\u304b\u3002<br \/>\n\u4f1a\u54e1\u306f\u7279\u5b9a\u5546\u54c1\u306e\u30ea\u30d4\u30fc\u30c8\u7387\u304c\u9ad8\u3044\u7b49\u3002<\/p>\n<h2>SQL\u3067\u76f8\u95a2\u4fc2\u6570(\u50be\u304d)<\/h2>\n<p>\u6a19\u6e96\u504f\u5dee\u3084\u5206\u6563\u306a\u3069\u306f\u6a19\u6e96\u306e\u95a2\u6570\u3067\u3042\u308b\u304c\u3001\u76f8\u95a2\u4fc2\u6570\u306f\u306a\u3044\u3002<br \/>\n\u96c6\u8a08\u7528\u306b\u50be\u304d\u3060\u3051\u6b32\u3057\u304b\u3063\u305f\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305aSQL\u3067\u6c42\u3081\u305f<\/p>\n<p>\u30c6\u30fc\u30d6\u30eb\u540d:t<br \/>\n\u7d50\u679c:17.2482570475901<\/p>\n<pre class=\"lang:plsql decode:true\">select t4.cor * ( t4.y_dev \/ t4.x_dev ) from (\r\n\r\n\tselect avg(t3.zz) \/ ( avg(t3.x_dev) * avg(t3.y_dev) ) as cor , avg(t3.x_dev) as x_dev , avg(t3.y_dev) as y_dev\r\n\tfrom (\r\n\r\n\t\tselect ( t2.xx * t2.yy ) as zz , t2.x_dev , t2.y_dev\r\n\t\tfrom (\r\n\r\n\t\t\tselect\r\n\t\t\t\tt.x_m , \r\n\t\t\t\tt.y_m , \r\n\t\t\t\tt.x_m - ( select avg(x_m) from t ) as xx , \r\n\t\t\t\tt.y_m - ( select avg(y_m) from t ) as yy , \r\n\t\t\t\t( select stdevp(x_m) from t ) as x_dev , \r\n\t\t\t\t( select stdevp(y_m) from t ) as y_dev\r\n\t\t\tfrom t \r\n\r\n\t\t) as t2\r\n\r\n\t) as t3\r\n\r\n) as t4<\/pre>\n<p>\u50be\u304d\u3067\u5229\u7528\u3057\u305f\u30b9\u30c8\u30a2\u30c9<\/p>\n<pre class=\"lang:tsql decode:true \">declare cur cursor for\r\nselect distinct \u30ab\u30fc\u30c9\u756a\u53f7_s from tbl\r\n\r\nopen cur\r\n\r\ndeclare @id bigint\r\nfetch next from cur into @id\r\n\r\nwhile @@fetch_status = 0\r\nbegin\r\n\r\nif 7 &lt;&gt; (select count(*) from tbl where \u30ab\u30fc\u30c9\u756a\u53f7_s = @id)\r\ngoto brk\r\n\r\nselect\r\n@id,\r\nt4.cor * ( t4.y_dev \/ t4.x_dev )\r\nfrom\r\n(\r\n\tselect\r\n\tavg(t3.zz) \/ ( avg(t3.x_dev) * avg(t3.y_dev) ) as cor , \r\n\tavg(t3.x_dev) as x_dev , \r\n\tavg(t3.y_dev) as y_dev\r\n\tfrom\r\n\t(\r\n\t\tselect\r\n\t\t(t2.xx * t2.yy) as zz , \r\n\t\tt2.x_dev , \r\n\t\tt2.y_dev\r\n\t\tfrom\r\n\t\t(\r\n\t\t\tselect\r\n\t\t\t\u96c6\u8a08\u671f\u9593\u6708_m - ( select avg(\u96c6\u8a08\u671f\u9593\u6708_m) from tbl where \u30ab\u30fc\u30c9\u756a\u53f7_s = @id ) as xx , \r\n\t\t\t\u8cb7\u4e0a\u91d1\u984d_m - ( select avg(\u8cb7\u4e0a\u91d1\u984d_m) from tbl where \u30ab\u30fc\u30c9\u756a\u53f7_s = @id ) as yy , \r\n\t\t\t( select stdevp(\u96c6\u8a08\u671f\u9593\u6708_m) from tbl where \u30ab\u30fc\u30c9\u756a\u53f7_s = @id ) as x_dev , \r\n\t\t\t( select stdevp(\u8cb7\u4e0a\u91d1\u984d_m) from tbl where \u30ab\u30fc\u30c9\u756a\u53f7_s = @id ) as y_dev\r\n\t\t\tfrom tbl\r\n\t\t\twhere \u30ab\u30fc\u30c9\u756a\u53f7_s = @id \r\n\t\t) \r\n\t\tas t2\r\n\t) \r\n\tas t3\r\n) \r\nas t4\r\n\r\nbrk:\r\nfetch next from cur into @id\r\n\r\nend\r\n\r\nclose cur\r\ndeallocate cur\r\n<\/pre>\n<p>SQl Server Management Studio\u3067\u306e\u7d50\u679c\u3092\u305d\u306e\u307e\u307e\u30a8\u30af\u30bb\u30eb\u306b\u8cbc\u308a\u4ed8\u3051\u305f\u304b\u3063\u305f\u306e\u3067\u3001<br \/>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u66f8\u304d\u65b9\u3067\u89e3\u6c7a\u3057\u305f\u3002<\/p>\n<pre class=\"lang:tsql decode:true \">declare @mydate nchar(10)\r\nset @mydate = '2017\/1\/1'\r\n\r\nselect \r\n(select sum(\u8cb7\u4e0a\u91d1\u984d_m) from tb4 where \u96c6\u8a08\u671f\u9593\u6708_d = @mydate),\r\n(select sum(\u8cb7\u4e0a\u91d1\u984d_m) from tb4 where \u96c6\u8a08\u671f\u9593\u6708_d = @mydate and \u8cb7\u4e0a\u56de\u6570_i &lt;= 1),\r\n(select sum(\u8cb7\u4e0a\u91d1\u984d_m) from tb4 where \u96c6\u8a08\u671f\u9593\u6708_d = @mydate and \u8cb7\u4e0a\u56de\u6570_i &gt;= 2 and \u8cb7\u4e0a\u56de\u6570_i &lt;= 4),\r\n(select sum(\u8cb7\u4e0a\u91d1\u984d_m) from tb4 where \u96c6\u8a08\u671f\u9593\u6708_d = @mydate and \u8cb7\u4e0a\u56de\u6570_i &gt;= 5 and \u8cb7\u4e0a\u56de\u6570_i &lt;= 7),\r\n(select sum(\u8cb7\u4e0a\u91d1\u984d_m) from tb4 where \u96c6\u8a08\u671f\u9593\u6708_d = @mydate and \u8cb7\u4e0a\u56de\u6570_i &gt;= 8 and \u8cb7\u4e0a\u56de\u6570_i &lt;= 10),\r\n(select sum(\u8cb7\u4e0a\u91d1\u984d_m) from tb4 where \u96c6\u8a08\u671f\u9593\u6708_d = @mydate and \u8cb7\u4e0a\u56de\u6570_i &gt;= 11 and \u8cb7\u4e0a\u56de\u6570_i &lt;= 15),\r\n(select sum(\u8cb7\u4e0a\u91d1\u984d_m) from tb4 where \u96c6\u8a08\u671f\u9593\u6708_d = @mydate and \u8cb7\u4e0a\u56de\u6570_i &gt;= 16 and \u8cb7\u4e0a\u56de\u6570_i &lt;= 20),\r\n(select sum(\u8cb7\u4e0a\u91d1\u984d_m) from tb4 where \u96c6\u8a08\u671f\u9593\u6708_d = @mydate and \u8cb7\u4e0a\u56de\u6570_i &gt;= 21)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6a19\u6e96\u504f\u5dee\u3001\u76f8\u95a2\u4fc2\u6570\u3001\u7dda\u5f62\u56de\u5e30\u306e\u6c42\u3081\u65b9\u3002 \u624b\u52d5\u8a08\u7b97\u3068\u30a8\u30af\u30bb\u30eb\u95a2\u6570\u3092\u4f7f\u3063\u305f\u5834\u5408\u3002 \u5206\u6790\u57fa\u790e \u30fb\u57fa\u672c \u7d50\u8ad6\u306f\u91d1\u984d\u63db\u7b97\u3057\u3066\u5206\u304b\u308a\u3084\u3059\u304f\u3002\u7d99\u7d9a\u89b3\u5bdf\u3057\u3066\u3044\u304f\u306a\u3089KPI\u3092\u8a2d\u5b9a\u3059\u308b\u3002 \u30fb\u30b5\u30f3\u30d7\u30eb\u306e\u4e2d\u3067\u5909\u6570\u306b\u5c5e\u6027\u3092\u8ffd\u52a0\u3002 \u4f8b) \u6765\u5e97\u7387\u304c\u4e0b &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=1014\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Excel \u6a19\u6e96\u504f\u5dee\u3001\u76f8\u95a2\u4fc2\u6570\u3001\u7dda\u5f62\u56de\u5e30&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[89,138],"class_list":["post-1014","post","type-post","status-publish","format-standard","hentry","category-1","tag-sql","tag-138"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/1014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1014"}],"version-history":[{"count":24,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/1014\/revisions"}],"predecessor-version":[{"id":6362,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/1014\/revisions\/6362"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}