The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
hello, got data from time attendance machine and want to create report and stuck.
first pic is data and i want to get pivot (pic 2), i know its easy but couldnt create calendar right. anyone help? thanks!
data
pivot
Solved! Go to Solution.
Hi @giorgionway ,
If you mean extract the total hours based on 'in', 'out' fields, you can try to use the following query:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCknKzMkszlTSUXJPzS9KTwUyDI30DA30DC0VDA2sDAyQBYyMQAKxOsjaXBLLMlNQdBmi6zKE6XJKLCnNBWnyy8xLRFZiia7FANMiFPcZorvPkBj3GaK7z5Cw+wzR3GeI5L5YAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [City = _t, #"Worker Name" = _t, In = _t, Out = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"City", type text}, {"Worker Name", type text}, {"In", type datetime}, {"Out", type datetime}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Worker Name"}, {{"Contents", each Table.AddColumn(Table.AddColumn(_,"Date",each Date.From([Out])),"Hour",each Duration.TotalHours([Out]-[In])), type table}}),
#"Expanded Contents" = Table.ExpandTableColumn(#"Grouped Rows", "Contents", {"Date", "Hour"}, {"Date", "Hour"}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Expanded Contents", {{"Date", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Expanded Contents", {{"Date", type text}}, "en-US")[Date]), "Date", "Hour", List.Sum)
in
#"Pivoted Column"
If above not meet for your requirement, can you please explain more about the logic about transforming your date fields?
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi @giorgionway ,
If you mean extract the total hours based on 'in', 'out' fields, you can try to use the following query:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCknKzMkszlTSUXJPzS9KTwUyDI30DA30DC0VDA2sDAyQBYyMQAKxOsjaXBLLMlNQdBmi6zKE6XJKLCnNBWnyy8xLRFZiia7FANMiFPcZorvPkBj3GaK7z5Cw+wzR3GeI5L5YAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [City = _t, #"Worker Name" = _t, In = _t, Out = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"City", type text}, {"Worker Name", type text}, {"In", type datetime}, {"Out", type datetime}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Worker Name"}, {{"Contents", each Table.AddColumn(Table.AddColumn(_,"Date",each Date.From([Out])),"Hour",each Duration.TotalHours([Out]-[In])), type table}}),
#"Expanded Contents" = Table.ExpandTableColumn(#"Grouped Rows", "Contents", {"Date", "Hour"}, {"Date", "Hour"}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Expanded Contents", {{"Date", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Expanded Contents", {{"Date", type text}}, "en-US")[Date]), "Date", "Hour", List.Sum)
in
#"Pivoted Column"
If above not meet for your requirement, can you please explain more about the logic about transforming your date fields?
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Portuguêsi couldnt find the answer. could you help me?
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
97 | |
80 | |
62 | |
57 |
User | Count |
---|---|
264 | |
120 | |
115 | |
83 | |
70 |