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.
Hi,
I am trying to paramaterize the number of days within date.isinpreviousNdays(datetime,number of days) function. But I am getting following error.
Expression.Error: We cannot convert the value "& DaysPrior &" to type Number.
Details:
Value=& DaysPrior &
Type=Type
Please find below my entire code:
let
Source = Exchange.Contents(ExchangeEmailID),
Mail1 = Source{[Name="Mail"]}[Data],
#"Filtered Rows1" = Table.SelectRows(Mail1, each Text.StartsWith([Folder Path], "\Inbox\")),
#"Filtered Rows" = Table.SelectRows(#"Filtered Rows1", each Date.IsInPreviousNDays([DateTimeReceived], "& DaysPrior &") or Date.IsInCurrentDay([DateTimeReceived])),
#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows", each Text.StartsWith([Subject], "Cash")),
#"Filtered Rows3" = Table.SelectRows(#"Filtered Rows2", each ([HasAttachments] = true)),
#"Filtered Rows4" = Table.SelectRows(#"Filtered Rows3", each Text.Contains([DisplayTo], "Dennis, Kristy A.") or Text.Contains([DisplayTo], " Matteson, Heather E") or Text.Contains([DisplayTo], "Galentine, Ginnie")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows4",{"Subject", "Attachments"}),
#"Inserted Text After Delimiter" = Table.AddColumn(#"Removed Other Columns", "Text After Delimiter", each Text.AfterDelimiter([Subject], " "), type text),
#"Renamed Columns" = Table.RenameColumns(#"Inserted Text After Delimiter",{{"Text After Delimiter", "Date"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Subject"}),
#"Added Custom" = Table.AddColumn(#"Removed Columns", "Custom", each [Attachments]{0}[AttachmentContent]),
#"Filtered Hidden Files1" = Table.SelectRows(#"Added Custom", each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File from CashBalance (2)", each #"Transform File from CashBalance (2)"([Custom])),
#"Removed Other Columns1" = Table.SelectColumns(#"Invoke Custom Function1",{"Date", "Transform File from CashBalance (2)"}),
#"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from CashBalance (2)", Table.ColumnNames(#"Transform File from CashBalance (2)"(#"Sample File (2)"))),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Portfolio", type text}, {"Cash Balance", Currency.Type}})
in
#"Changed Type1"
Please let me know ASAP how to paramaterize the 90 days within the function.
Solved! Go to Solution.
@Anonymous,
I am assuming DaysPrior is your parameter, you can remove the double quotes and the & signs, it should work. If that still doesnt work, check your parameter type or to convert DaysPrior to number using Numbers.From(DaysPrior)
@Anonymous,
I am assuming DaysPrior is your parameter, you can remove the double quotes and the & signs, it should work. If that still doesnt work, check your parameter type or to convert DaysPrior to number using Numbers.From(DaysPrior)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
105 | |
79 | |
69 | |
62 |
User | Count |
---|---|
143 | |
104 | |
103 | |
82 | |
70 |