Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
giorgionway
Frequent Visitor

work attendance

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!

datadatapivotpivot

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @giorgionway ,

If you mean extract the total hours based on 'in', 'out' fields, you can try to use the following query:

14.png

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @giorgionway ,

If you mean extract the total hours based on 'in', 'out' fields, you can try to use the following query:

14.png

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
MFelix
Super User
Super User

Hi @giorgiinway,

There are several options to achieve this checks a list of post that have similar questions that may help you achieve expected result.

https://community.powerbi.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=fals...

If you don't find the answer you need please tell me and I can try to assist you.

Regards,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



i couldnt find the answer. could you help me?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.