Forum Discussion
Calendar Days Decades
- 5 years ago
Hello Pillic
you can add a nestef if-function to achieve this. Here the formula
if [Tag]<11 then 1 else if [Tag]<21 then 2 else 3If you would not have the day-value in your table, but only a date-value you could substitute the [Tag] with Date.Day([Date]).
here a complete example
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Lc67DcAwDAPRXVSnCKk4n1kM779GAJ6bU8UHzVmqdcxy2umVjvROn/RNv1Qnh7WYi70AhCAIYQhEKEbx/gHFKEYxilGMYhSjNErvX2qtHw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Tag = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Tag", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Decade", each if [Tag]<11 then 1 else if [Tag]<21 then 2 else 3) in #"Added Custom"Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello Pillic
you can add a nestef if-function to achieve this. Here the formula
if [Tag]<11 then 1 else if [Tag]<21 then 2 else 3
If you would not have the day-value in your table, but only a date-value you could substitute the [Tag] with Date.Day([Date]).
here a complete example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Lc67DcAwDAPRXVSnCKk4n1kM779GAJ6bU8UHzVmqdcxy2umVjvROn/RNv1Qnh7WYi70AhCAIYQhEKEbx/gHFKEYxilGMYhSjNErvX2qtHw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Tag = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Tag", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Decade", each if [Tag]<11 then 1 else if [Tag]<21 then 2 else 3)
in
#"Added Custom"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Great that works, Thanks a lot!