定義名 | 値(手入力:東京エリアの場合) | 備考 |
---|---|---|
R_Area | 03_東京 | 各エリアに応じて。 頭0付2桁の番号も付与 |
R_URL_1 | https://www.tepco.co.jp/forecast/html/area_data-j.html | 各一送「でんき予報」のメインページURL |
R_URL_2 | https://www.tepco.co.jp/forecast/html/area_jukyu-j.html | 各年月分ダウンロードデータファイルリンクの収録ページURL |
R_Encode_CSV | 65001 | 65001:Unicode (UTF-8)、 932 :日本語 (シフト JIS) など |
R_URL_DL_Key_1 | eria_jukyu_ | データファイル名の接頭辞 |
R_URL_DL_Key_2 | .csv | データファイルの拡張子 |
R_URL_DL_Key_3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
R_URL_DL_Key_1 = Excel.CurrentWorkbook(){[Name="R_URL_DL_Key_1"]}[Content]{0}[Column1], | |
R_URL_DL_Key_2 = Excel.CurrentWorkbook(){[Name="R_URL_DL_Key_2"]}[Content]{0}[Column1], | |
R_URL_DL_Key_3 = Excel.CurrentWorkbook(){[Name="R_URL_DL_Key_3"]}[Content]{0}[Column1], | |
R_URL_Prefix = Excel.CurrentWorkbook(){[Name="R_URL_Prefix"]}[Content]{0}[Column1], | |
// ★ R_URL_2 のhtmlをテキストで読み込み | |
ソース = Q_HTML, | |
// ★ R_URL_DL_Key_1、R_URL_DL_Key_2 の両方を含む行の絞込み | |
DL_Keyフィルター = Table.SelectRows(ソース, each Text.Contains([HTML], R_URL_DL_Key_1) and Text.Contains([HTML], R_URL_DL_Key_2)), | |
// ★ R_URL_Prefix を使って、DLすべきURLを生成 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
R_URL_2 = Excel.CurrentWorkbook(){[Name="R_URL_2"]}[Content]{0}[Column1], | |
// ★ R_URL_2 のhtmlをテキストで読み込み | |
ソース = Table.FromColumns({Lines.FromBinary(Web.Contents(R_URL_2))}), | |
HTML = Table.RenameColumns(ソース,{{"Column1", "HTML"}}), | |
行番号 = Table.AddIndexColumn(HTML, "行番号", 1, 1, Int64.Type), | |
並べ替えられた列 = Table.ReorderColumns(行番号,{"行番号", "HTML"}) | |
in | |
並べ替えられた列 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
R_Area = Excel.CurrentWorkbook(){[Name="R_Area"]}[Content]{0}[Column1], | |
R_URL_DL = Excel.CurrentWorkbook(){[Name="R_URL_DL"]}[Content]{0}[Column1], | |
R_Encode_CSV = Excel.CurrentWorkbook(){[Name="R_Encode_CSV"]}[Content]{0}[Column1], | |
ソース = Csv.Document(Web.Contents(R_URL_DL),[Delimiter=",", Columns=20, Encoding=R_Encode_CSV, QuoteStyle=QuoteStyle.None]), | |
削除された最初の行 = Table.Skip(ソース,1), | |
昇格されたヘッダー数 = Table.PromoteHeaders(削除された最初の行, [PromoteAllScalars=true]), | |
変更された型 = Table.TransformColumnTypes(昇格されたヘッダー数,{{"DATE", type date}, {"TIME", type time}, {"エリア需要", type number}, {"原子力", type number}, {"火力(LNG)", type number}, {"火力(石炭)", type number}, {"火力(石油)", type number}, {"火力(その他)", type number}, {"水力", type number}, {"地熱", type number}, {"バイオマス", type number}, {"太陽光発電実績", type number}, {"太陽光出力制御量", type number}, {"風力発電実績", type number}, {"風力出力制御量", type number}, {"揚水", type number}, {"蓄電池", type number}, {"連系線", type number}, {"その他", type number}, {"合計", type number}}), | |
null0置換 = Ta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
ソース = Q_Read_CSV_RealTime, | |
削除された他の列 = Table.SelectColumns(ソース,{"Date_Time"}), | |
並べ替えられた行 = Table.Sort(削除された他の列,{{"Date_Time", Order.Descending}}), | |
No = Table.AddIndexColumn(並べ替えられた行, "No", 1, 1, Int64.Type), | |
フィルターされた行 = Table.SelectRows(No, each [No] = 1), | |
削除された他の列1 = Table.SelectColumns(フィルターされた行,{"No", "Date_Time"}) | |
in | |
削除された他の列1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
ソース = Excel.CurrentWorkbook(){[Name="T_Term_Monthly"]}[Content], | |
変更された型 = Table.TransformColumnTypes(ソース,{{"始期", type datetime}, {"終期", type datetime}}), | |
#"30分暦生成" = List.DateTimes(変更された型[始期]{0}, 48 * (Number.From(変更された型[終期]{0}) - Number.From(変更された型[始期]{0}) + Number.From(#duration(0,0,30,0))), #duration(0, 0, 30, 0)), | |
テーブルに変換済み = Table.FromList(#"30分暦生成", Splitter.SplitByNothing(), null, null, ExtraValues.Error), | |
年月日時間帯 = Table.RenameColumns(テーブルに変換済み,{{"Column1", "年月日時間帯"}}), | |
年月日 = Table.AddColumn(年月日時間帯, "年月日", each DateTime.Date([年月日時間帯])), | |
週番号 = Table.AddColumn(年月日, "週番号", each Date.WeekOfYear([年月日],Day.Monday)), | |
年 = Table.AddColumn(週番号, "年", each Date.Year([年月日時間帯])), | |
月 = Table.AddColumn(年, "月", each Date.Month([年月日時間帯])), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
ソース = Q_Monthly_Calendar, | |
マージされたクエリ数 = Table.NestedJoin(ソース, {"年月日時間帯"}, Q_Read_CSV_RealTime, {"Date_Time"}, "Q_Read_CSV_RealTime", JoinKind.LeftOuter), | |
展開されたQ_Read_CSV_RealTime = Table.ExpandTableColumn(マージされたクエリ数, "Q_Read_CSV_RealTime", {"供給エリア", "供給力-需要", "エリア需要", "原子力", "風力_可能", "太陽光_可能", "地熱", "バイオマス", "水力", "火力_石炭", "火力_LNG", "火力_石油", "火力_その他", "その他", "蓄電池発電", "揚水発電", "連系線_入", "蓄電池充電", "揚水動力", "連系線_出", "太陽光_抑制", "風力_抑制", "正側計", "負側計", "正側計_当月最大", "負側計_当月最小"}, {"供給エリア", "供給力-需要", "エリア需要", "原子力", "風力_可能", "太陽光_可能", "地熱", "バイオマス", "水力", "火力_石炭", "火力_LNG", "火力_石油", "火力_その他", "その他", "蓄電池発電", "揚水発電", "連系線_入", "蓄電池充電", "揚水動力", "連系線_出", "太陽光_抑制", "風力_抑制", "正側計", "負側計", "正側計_当月最大", "負側計_当月最小"}), | |
並べ替えられた行 = Table.Sort(展開されたQ_Read_CSV_RealTime,{{"年月日時間帯", Order.Ascending}}), | |
Buffer = Table.Buffer(並べ替えられた行) | |
in | |
Buffer |
種類 | 内訳 | 個数 |
---|---|---|
テーブル | 一般送配電事業者の一覧 | 1 |
名前定義 | 最初に8個 (値は手入力) 途中で3個 (値は関数) 後で2個 (値は関数) |
13 |
クエリー | ワークシート読み込み3個 接続のみ2個 接続のみ・データモデル読み込み1個 |
6 |
ピボットテーブル | 1つはデータモデル (Power Pivot) から作成 | 3 |
スライサー | 年月指定2個、日付指定1個 | 3 |
定義名 | 数式 | 備考 |
---|---|---|
S_DL_No | =IF('3_PVT_DL_URL_List'!$B$6="(すべて)",1,INDEX(Q_DL_URL_List[#すべて],MATCH('3_PVT_DL_URL_List'!$B$6,Q_DL_URL_List[[#すべて],[年月]],0),MATCH(Q_DL_URL_List[[#見出し],[新しい順]],Q_DL_ |
始期 | 終期 |
---|---|
=INDEX(Q_DL_URL_List[#すべて],MATCH(S_DL_No,Q_DL_URL_List[[#すべて],[新しい順]],0),MATCH(Q_DL_URL_List[[#見出し],[年月]],Q_DL_URL_List[#見出し],0)) | =EOMONTH([@始期],0)+TIME(23,30,0) |
OlderNewer