Forum Discussion
Countifs
- 2 years ago
- Prepare your table to this format:
2. Name your Query i.e. MyData (without spaces and special characters)
3. Create blank query, open advanced editor, select whole code and replace it with the code I provided above.
4. Close Advanced Editor
5. Select Source Step from right panel Query Settings
6. Delete whole code of Source step (as you can see selected in the picture in Note below in my signature) and write there = MyData (which is your table reference)
I dont understand step 4, the code pasted is from step 3.)
let
Source = Json.Document(Web.Contents("https://rest.datapoint.dk")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"GSRN", "ProductionMeterPoint", "ConsumptionMeterPoint", "TurbineID", "TurbineName", "LegalOwner", "PortFolio", "CapacityMW", "BalanceResponsible", "DWI", "Ownership_Percent", "PriceCode", "FacilityAddress", "AcquisitionDate", "MA_Deal", "Land", "LeaseDKK", "LeasePercent", "LeaseRenewalYear"}, {"GSRN", "ProductionMeterPoint", "ConsumptionMeterPoint", "TurbineID", "TurbineName", "LegalOwner", "PortFolio", "CapacityMW", "BalanceResponsible", "DWI", "Ownership_Percent", "PriceCode", "FacilityAddress", "AcquisitionDate", "MA_Deal", "Land", "LeaseDKK", "LeasePercent", "LeaseRenewalYear"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",{{"GSRN", type text}, {"ProductionMeterPoint", type text}, {"ConsumptionMeterPoint", type text}, {"TurbineID", Int64.Type}, {"TurbineName", type text}, {"LegalOwner", type text}, {"PortFolio", type text}, {"CapacityMW", type number}, {"BalanceResponsible", type text}, {"DWI", Int64.Type}, {"Ownership_Percent", Int64.Type}, {"PriceCode", type text}, {"FacilityAddress", type text}, {"AcquisitionDate", type datetimezone}, {"MA_Deal", type text}, {"Land", type text}, {"LeaseDKK", type text}, {"LeasePercent", Percentage.Type}, {"LeaseRenewalYear", type text}}),
#"Replaced Errors" = Table.ReplaceErrorValues(#"Changed Type", {{"ProductionMeterPoint", null}}),
#"Replaced Errors1" = Table.ReplaceErrorValues(#"Replaced Errors", {{"TurbineID", null}}),
#"Merged Queries" = Table.NestedJoin(#"Replaced Errors1", {"ProductionMeterPoint"}, Afregnet, {"mRID"}, "Afregnet", JoinKind.LeftOuter),
#"Expanded Afregnet" = Table.ExpandTableColumn(#"Merged Queries", "Afregnet", {"Date", "Afregnet produktion"}, {"Afregnet.Date", "Afregnet.Afregnet produktion"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded Afregnet",{{"Afregnet.Date", "Date"}, {"Afregnet.Afregnet produktion", "Afregnet produktion"}})
in
#"Renamed Columns"- Prepare your table to this format:
2. Name your Query i.e. MyData (without spaces and special characters)
3. Create blank query, open advanced editor, select whole code and replace it with the code I provided above.
4. Close Advanced Editor
5. Select Source Step from right panel Query Settings
6. Delete whole code of Source step (as you can see selected in the picture in Note below in my signature) and write there = MyData (which is your table reference)