Forum Discussion
mohammedald
2 years agoHelper I
I need Help With A Date Formula
Hello, Thank you so much for your time I will get right into the, So to explain the problem so you have more context I have a dashboard that is connected through CRM online and we have deals that...
mohammedald
2 years agoHelper I
Here is the sample data with the error
https://drive.google.com/drive/folders/1tVJbW8RdRg7jgNqVb4BDKpnqQ9RdPAJv?usp=sharing
dufoq3
2 years agoCommunity Champion
I need this file...
C:\Users\Mohammed\Downloads\Test Date.xlsx, but what I see from your query is that you didn't read carefully my Note!
Try this, but this time do not add it as custom column. Open Advanced Editor, delete whole query and paste there this one.
let
Source = Excel.Workbook(File.Contents("C:\Users\Mohammed\Downloads\Test Date.xlsx"), null, true),
Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
TrimmedColumnNames = Table.TransformColumnNames(Table1_Table, Text.Trim),
ChangedType = Table.TransformColumnTypes(TrimmedColumnNames,{
{"Est Close Date", type date}, {"Close Date", type date}}),
Ad_EstCloseYear = Table.AddColumn(ChangedType, "Est Close Year", each Date.Year([Est Close Date]), Int64.Type),
Ad_CloseYear = Table.AddColumn(Ad_EstCloseYear, "Close Year", each Date.Year([Close Date]), Int64.Type),
Ad_NewCloseDate = Table.AddColumn(Ad_CloseYear, "New Close Date", each
[ today = Date.From(DateTime.FixedLocalNow()),
thisYear = Date.Year(today),
result = if [Deal Stage] <> "Won" then null else
if [Close Date] = null and [Est Close Year] = thisYear then today else
if [Close Date] = null and [Est Close Year] < thisYear then [Est Close Date] else
if [Close Year] > [Est Close Year] then [Est Close Date]
else [Close Date]
][result], type date)
in
Ad_NewCloseDate