Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
in this problem I need that needed column in power bi.. condition is in that type column if there is KT the seq no is print but there is no KT in type there are two conditions the mat and before mat is same then add needed last answer and quantity if two conditions are false just print 10;.... If you can't get my problem please see the Excel formula... I hope u can understand my problem.. and please help me with it....
You can use the List.Generate function in a Table.Group aggregation to generate that extra column:
let
//change next line to reflect data source
Source = Excel.CurrentWorkbook(){[Name="Table7"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"mat", type text}, {"seq no", Int64.Type}, {"type", type text}, {"quantity", Int64.Type}}),
//Group rows by mat
#"Grouped Rows" = Table.Group(#"Changed Type", {"mat"}, {
{"needed", (t)=>
Table.FromColumns(
Table.ToColumns(t) &
{List.Generate(
()=>[n=if t[type]{0}="KT" then t[seq no]{0} else 10, idx=0],
each [idx] < Table.RowCount(t),
each [n=if t[type]{[idx]+1}="KT" then t[seq no]{[idx]+1} else [n]+t[quantity]{[idx]+1} , idx=[idx]+1],
each [n])},
Table.ColumnNames(t) & {"needed"})
}}),
#"Expanded needed" = Table.ExpandTableColumn(#"Grouped Rows", "needed", {"seq no", "type", "quantity", "needed"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded needed",{{"seq no", Int64.Type}, {"type", type text}, {"quantity", Int64.Type}, {"needed", Int64.Type}})
in
#"Changed Type1"
Can you tell me how to do in dax functions or measures....
Isn't there a DAX forum? I thought this was for Power Query. In any event, it's not something I'd be able to get to any time soon.
=Table.FromRows(List.Accumulate(Table.ToRows(PreviousStepName),{{},"",0},(x,y)=>let a=if y{2}="KT" then y{1} else if y{0}=x{1} then y{3}+x{2} else 10 in {x{0}&{y&{a}},y{0},a}){0},Table.ColumnNames(PreviousStepName)&{"needed"})
Can you tell me how to do in dax functions or measures....