Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi all,
I have a data set as shown in the input table,
Against each product name & product band, I have 2 KPI categories, 1. 3 KPI and 2. 5 KPI. In columns 3 & 4 I have total pass KPIs in each category. In the following few columns I have the details for failed KPIs in terms of 1 & 0. 1 means KPI is pass & 0 means KPI is fail.
Now I want to summarize my table where I can have only one row for each Product name & Product band combination, followed by pass KPI count in the next 2 columns for 2 different categories, and in the next 2 columns I want the failed KPI names separated by commas, as shown in output table.
Pls help, how I can do this either through power Query editor or by using some DAX.
Input table
| Product name | Product band | KPI Category - 3 KPI(KPI1,KPI2,KPI3) | KPI Category - 5 KPI(KPI1,KPI2,KPI3,KPI4,KPI5) | KPI1 | KPI2 | KPI3 | KPI4 | KPI5 |
| Car | 7 | 3 | 5 | 1 | 1 | 1 | 1 | 1 |
| Car | 3 | 1 | 2 | 1 | 0 | 0 | 0 | 1 |
| Bike | 7 | 2 | 2 | 1 | 1 | 0 | 0 | 0 |
| Bike | 3 | 3 | 3 | 1 | 1 | 1 | 0 | 0 |
| Cycle | 7 | 3 | 4 | 1 | 1 | 1 | 1 | 0 |
| Cycle | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Output table
| Product name | Product band | Total pass in 3 KPI | Total pass in 5 KPI | Failed KPI -KPI Category - 3 KPI(KPI1,KPI2,KPI3) | Failed KPI - KPI Category - 5 KPI(KPI1,KPI2,KPI3,KPI4,KPI5) |
| Car | 7 | 3 | 5 | ||
| Car | 3 | 1 | 2 | KPI2,KPI3 | KPI2, KPI3, KPI4 |
| Bike | 7 | 2 | 2 | KPI3 | KPI3, KPI4, KPI5 |
| Bike | 3 | 3 | 3 | KPI4, KPI5 | |
| Cycle | 7 | 3 | 4 | KPI5 | |
| Cycle | 3 | 0 | 0 | KPI1,KPI2,KPI3 | KPI1,KPI2,KPI3,KPI4,KPI5 |
Solved! Go to Solution.
Hi
Add new columns
=Text.Combine(List.Transform({{[KPI1],"KPI1"},{[KPI2],"KPI2"},{[KPI3],"KPI3"}}, each if _{0}=0 then _{1} else null), ",")and
Text.Combine(List.Transform({{[KPI1],"KPI1"},{[KPI2],"KPI2"},{[KPI3],"KPI3"},{[KPI4],"KPI4"},{[KPI5],"KPI5"}}, each if _{0}=0 then _{1} else null), ",") Stéphane
Hi
Add new columns
=Text.Combine(List.Transform({{[KPI1],"KPI1"},{[KPI2],"KPI2"},{[KPI3],"KPI3"}}, each if _{0}=0 then _{1} else null), ",")and
Text.Combine(List.Transform({{[KPI1],"KPI1"},{[KPI2],"KPI2"},{[KPI3],"KPI3"},{[KPI4],"KPI4"},{[KPI5],"KPI5"}}, each if _{0}=0 then _{1} else null), ",") Stéphane
Thanks for the help. It works for me.
Hi prashantg364,
If you want to achieve this with the simple calculated column using dax.
Step 1:
Concatenate the columns.
Hello, @prashantg364
let
Source = your_table,
lst03 = {"KPI1", "KPI2", "KPI3"},
lst05 = {"KPI1", "KPI2", "KPI3", "KPI4", "KPI5"},
f = (r as record, lst as list) =>
List.Accumulate(
lst,
{},
(s, c) => s & (if Record.Field(r, c) = 0 then {c} else {})
),
comb = Table.CombineColumnsToRecord(Source, "KPI", lst05),
txf = Table.TransformColumns(comb, {"KPI", (x) => f(x, lst05)}),
failed3 =
Table.AddColumn(
txf, "Failed KPI -KPI Category - 3 KPI(KPI1,KPI2,KPI3)",
(x) => Text.Combine(List.Select(x[KPI], (w) => List.Contains(lst03, w)), ", ")
),
failed5 = Table.AddColumn(failed3, "Failed KPI - KPI Category - 5 KPI(KPI1,KPI2,KPI3,KPI4,KPI5)", each Text.Combine([KPI], ", ")),
remove_kpi = Table.RemoveColumns(failed5,{"KPI"})
in
remove_kpi
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |