Query gives zero result for group with item values <1

mcnicollwj02

New Member
Joined
Nov 6, 2020
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I have a simple query of a table containing names, month end dates and labor hours. The query is simply a sum of hours by name. For one name having entries for hours that are all less than 1, the query gives a sum of zero. If I change a value in the table to 1, the query gives a result of 1. If I put in any number >1, the query will pick it up. But when all values are <1, the query results in zero. All other data seems to be summing as expected.

Why would the query give a result of zero and how do I get it to give the correct sum?
 
anyway with fast test without rounding
NameSum
Calvin Coolidge1455.146
Grover Cleveland1489.506
Herbert Hoover1468.89
Racer X3.609784946

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Name"}, {{"Sum", each List.Sum([Hours]), type number}})
in
    Group
then you can round it
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
with round
NameSum
Calvin Coolidge1455.15
Grover Cleveland1489.51
Herbert Hoover1468.89
Racer X3.61

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Name"}, {{"Sum", each List.Sum([Hours]), type number}}),
    Round = Table.TransformColumns(Group,{{"Sum", each Number.Round(_, 2), type number}})
in
    Round

IMHO, you should round AFTER sum not BEFORE
 
Upvote 0
Got it, thanks. I'm wondering how that integer type got in there. I didn't do anything that was meant to change the data type.
 
Upvote 0
Table.TransformColumnTypes is added automatically (you can turn it off as I did) and maybe not recognised your data properly
 
Upvote 0
type.png

unfortunately with another / new workbook it will be turned on
easier and faster is just remove this step :biggrin:
 
Upvote 0
Did you mention Advanced Editor by mistake or is there an Advanced Editor somewhere other than in the Power Query Editor?

File - Options has no Query Options.
 
Upvote 0
sure, it should be Power Query Editor, my mistake

or use a "normal" Excel not a 365 ;)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,757
Messages
6,174,330
Members
452,555
Latest member
colc007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top