Reputation: 325
In power query I have this line of code:
#"Added Custom1" =
Table.AddColumn(#"Added Conditional Column",
"Receipt time norm in hour",
each [Number of receipt lines] *
Table.TransformColumnTypes(
Excel.CurrentWorkbook(){[Name="OneLineTimeNorm"]}[Content],
{{"OneLineTimeNorm", type number}}
){0}[OneLineTimeNorm]/3600),
part:
Excel.CurrentWorkbook(){[Name="OneLineTimeNorm"]}[Content]
refers to a workbook sheet with only a number in it "2.8" and has no formula whatsoever. So I have no idea why this calculation in query was made in this way. My question is how I could do this calculation 2.8/3600 with M language within the query?
Upvotes: 1
Views: 102
Reputation: 40204
What this is doing is pulling in the value from a named range (Name="OneLineTimeNorm"
) in the Excel document. I'm guessing it was designed this way so that you could change that part of the query without having to open the query editor (just update the cell instead).
You can simplify it to this:
#"Added Custom1" =
Table.AddColumn(
#"Added Conditional Column",
"Receipt time norm in hour", each [Number of receipt lines] * 2.8 /3600
),
Upvotes: 1