Forum Discussion
LudivineLOU
2 years agoHelper I
Lookup between 2 days
Hello, I have a price table with different article and price validate for the period between "valid from" until "valid to" Table price : Article valid from valid to pri...
- 2 years ago
Does it need to be DAX?
Prices:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hY5RCoAgEESvEn6L7Kwl/tY1xLt5Fk/WalQWmTAsDOxjXggqpymntd4rSiuCkTAxScnJwoBLhVSQinpMciWxGHJN5T8W7vF8rtpDAvPNbp+7tmtMI/Sl7FvlX7g4+76zEzju", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Article = _t, #"valid from" = _t, #"valid to" = _t, price = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Article", type text}, {"valid from", type date}, {"valid to", type date}, {"price", Currency.Type}},"de"), #"Trimmed Text" = Table.TransformColumns(#"Changed Type",{{"Article", Text.Trim, type text}}) in #"Trimmed Text"Orders:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDSMzDRMzIwMlDSUTq0QKEosdzw0AIIG4gcgexYHYLKnKDKDM31DCxAyoxwK4sFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"order date" = _t, #"order " = _t, article = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"order date", type date}, {"order ", type text}, {"article", type text}},"de"), #"Trimmed Text" = Table.TransformColumns(#"Changed Type",{{"order ", Text.Trim, type text}, {"article", Text.Trim, type text}}), #"Added Custom" = Table.AddColumn( #"Trimmed Text", "Price", (k) => Table.SelectRows( Prices, each [Article] = k[article] and [valid from] <= k[order date] and k[order date] <= [valid to] ){0}[price], Currency.Type ) in #"Added Custom"
Greg_Deckler
2 years agoCommunity Champion