Forum Discussion
Eddistoff
3 years agoNew Member
Problems with format dates entered
Hi everyone, I need your assistance please, I am barely new using PBI and I have a situation with dates. There is a template of excel fulfilled by people who manage a process, so I required to get ...
- 3 years ago
Hi Eddistoff ,
Add this as a new custom column to restate the approval date in the correct format:
let __cDate = Date.AddMonths(Date.From([Date of registration]), 1) in if Date.From([Date of approval]) < Date.From([Date of registration]) or Date.From([Date of approval]) > __cDate then Text.Combine( { Text.Middle([Date of approval], 3, 2), Text.Start([Date of approval], 2), Text.End([Date of approval], 4) }, "/" ) else [Date of approval]From here you can change the data type of your new column to Date Type and perform your calculation.
Example as working query:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jZBBC8IwDIX/S88bTdLMrWd33Vlk7CTizUHx/+Mrri4HpSuENo98fUnm2ZF66ryQiGscI5DtwnlN6X574TWO7TS1Vxy3NMCip6FU5UDGVIRLWp8P3CDA7ZAaKGQIv2gNYk9SanRrUA41+B2j27BY8wLUl5pTXggZ4b9XMF79x6u6DA5mjCF76ZG5hM3KYl6+GOE3trwB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date of registration" = _t, Product = _t, #"Date of approval" = _t, #"Comments " = _t, #"Format entered" = _t]), chgRegDateType = Table.TransformColumnTypes(Source,{{"Date of registration", type date}}), addDtApproval = Table.AddColumn( chgRegDateType, "dtApproval", each let __cDate = Date.AddMonths(Date.From([Date of registration]), 1) in if Date.From([Date of approval]) < Date.From([Date of registration]) or Date.From([Date of approval]) > __cDate then Text.Combine( { Text.Middle([Date of approval], 3, 2), Text.Start([Date of approval], 2), Text.End([Date of approval], 4) }, "/" ) else [Date of approval] ) in addDtApprovalWorking query output:
Pete
Eddistoff
3 years agoNew Member
Thanks a lot for yout help!!!!