Forum Discussion
KarlConstruct
6 years agoFrequent Visitor
Need Help Writing a Dated Difference Formula
I have a txt file brought into PowerBI via a sharepoint folder, and its a list of transmitted documents and the dates in which each transmission happened. I don't necessarily care about all of the c...
v-lid-msft
6 years agoCommunity Support
Hi KarlConstruct ,
We can filter the rows of first date and the last date in power query editor if you need.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zc67DcAgDEDBXVyDZPMNZcIYiP3XSAQNymuvujHkFidBrXk1r0Gm+1EkJVImlUXPSZV0kRrIlGSkve8nRVIiZVIhVdK3ny8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Date", type date}}),
Test = Table.SelectRows(
#"Changed Type",
each let d = [Date],
n = [Name],
t = Table.SelectRows(#"Changed Type", each [Name]=n),
isMin = List.Contains(Table.ToList(Table.TransformColumnTypes(Table.SelectColumns(Record.ToTable(Table.Min(Table.SelectColumns(t,"Date"),"Date")),"Value"),{{"Value",type text}})),Date.ToText(d)),
isMax = List.Contains(Table.ToList(Table.TransformColumnTypes(Table.SelectColumns(Record.ToTable(Table.Max(Table.SelectColumns(t,"Date"),"Date")),"Value"),{{"Value",type text}})),Date.ToText(d))
in
isMin or isMax
)
in
Test
The formula may need to do some change based on the type and name of columns.
BTW, pbix as attached.
Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.