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.
Hey everybody,
Hope to find you well!
Trying to create a new column in the raw data that looks at the Gross Price of a product per specific store.
Anyone recommends a syntax that can do something like the column Type below?
Thanks and hope you are all well
Solved! Go to Solution.
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdAxDoAgDIXhuzAzUFowjnICE0fC/a8hxJjgz+Dyhi/0lbRWdx3Ou3NEUtf8ByLh94UYYR4pPWIiZMJGMMJSGgCyP1Def1gkKMEAGgAihLl0WTtCDRCVEAjC0kzoJ2w3", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Store Type" = _t, Product = _t, #"Gross Price" = _t]),
#"Grouped Rows" = Table.Group(Source, {"Store Type", "Product"}, {{"Temp", (x)=> Table.AddColumn(x,"Type",each if List.Contains(List.LastN(x[Gross Price],2),[Gross Price]) then "Promo" else "Full Price"), type table}}),
#"Expanded Temp" = Table.ExpandTableColumn(#"Grouped Rows", "Temp", {"Gross Price", "Type"}, {"Gross Price", "Type"})
in
#"Expanded Temp"
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdAxDoAgDIXhuzAzUFowjnICE0fC/a8hxJjgz+Dyhi/0lbRWdx3Ou3NEUtf8ByLh94UYYR4pPWIiZMJGMMJSGgCyP1Def1gkKMEAGgAihLl0WTtCDRCVEAjC0kzoJ2w3", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Store Type" = _t, Product = _t, #"Gross Price" = _t]),
#"Grouped Rows" = Table.Group(Source, {"Store Type", "Product"}, {{"Temp", (x)=> Table.AddColumn(x,"Type",each if List.Contains(List.LastN(x[Gross Price],2),[Gross Price]) then "Promo" else "Full Price"), type table}}),
#"Expanded Temp" = Table.ExpandTableColumn(#"Grouped Rows", "Temp", {"Gross Price", "Type"}, {"Gross Price", "Type"})
in
#"Expanded Temp"
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.