Forum Discussion
Adding alias to table column names
- 2 years ago
Hi Justas4478,
I think I figured out what might be going on.
When you shared the sample data, it looks like this...
I wonder if it was just Excel that added that date portion?
If that's the case I'll need to edit the code. It would be good to have a sample file with the correct formats.
------
I've done some checks and I think you should just be able to delete that one step.
Try this code.
let Source = Table1, Unpivot = Table.UnpivotOtherColumns(Source, {"Per_sBadgeNo", "AttDate"}, "Attribute", "Value"), CT1 = Table.TransformColumnTypes( Unpivot, { {"Per_sBadgeNo", Int64.Type}, {"AttDate", type date}, {"Attribute", type text}, {"Value", type duration} } ), GR1 = Table.Group( CT1, {"Per_sBadgeNo", "AttDate"}, {{"Duration", each List.Sum([Value]), type nullable duration}} ), AddTotalMinutes = Table.AddColumn( GR1, "Total Minutes", each Duration.TotalMinutes([Duration]), type number ), AddTotalHours = Table.AddColumn( AddTotalMinutes, "Total Hours", each Duration.TotalHours([Duration]), type number ) in AddTotalHours
Hi KNP I tried to use code that you provided it worked for most of the steps, but for this step it just changed all values to empty. I dont know what went wrong.
{{"Value", each Text.BetweenDelimiters(Text.From(_, "en-NZ"), " ", " "), type text}}
Hi Justas4478,
The only obvious thing that I overlooked when I pasted the code is the culture ("en-NZ") change this to whatever is appropriate to you (en-US?) and that may solve the issue.
- Justas44782 years agoPost Prodigy
Hi KNP I tried changing to US and it still makes all values empty.
These are the format values are in.- KNP2 years agoSuper User
Hi Justas4478,
I think I figured out what might be going on.
When you shared the sample data, it looks like this...
I wonder if it was just Excel that added that date portion?
If that's the case I'll need to edit the code. It would be good to have a sample file with the correct formats.
------
I've done some checks and I think you should just be able to delete that one step.
Try this code.
let Source = Table1, Unpivot = Table.UnpivotOtherColumns(Source, {"Per_sBadgeNo", "AttDate"}, "Attribute", "Value"), CT1 = Table.TransformColumnTypes( Unpivot, { {"Per_sBadgeNo", Int64.Type}, {"AttDate", type date}, {"Attribute", type text}, {"Value", type duration} } ), GR1 = Table.Group( CT1, {"Per_sBadgeNo", "AttDate"}, {{"Duration", each List.Sum([Value]), type nullable duration}} ), AddTotalMinutes = Table.AddColumn( GR1, "Total Minutes", each Duration.TotalMinutes([Duration]), type number ), AddTotalHours = Table.AddColumn( AddTotalMinutes, "Total Hours", each Duration.TotalHours([Duration]), type number ) in AddTotalHours- Justas44782 years agoPost Prodigy
KNP Yea this works now.
Thank you for the help.