Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi Everyone,
I am new to PBI and needed some help.I have a scenario where i need the rows to be merged / grouped:
The below table is what i have in my data :
| Title | Type |
A | Both |
| A | Part1 only |
| A | Part2 only |
| A | NA |
| B | Part1 only |
| B | Part2 only |
| B | NA |
| C | Part1 only |
| C | NA |
| D | Part2 only |
| D | NA |
| E | NA |
and the below table is what I am looking to get :
| Title | Type |
| A | Both |
| B | Both |
| C | Part1 only |
| D | Part2 only |
| E | NA |
Explanation : Both > Part1 AND Part2 > Part1 > Part 2 > NA.
(In case of Title B it comes as Both because it has two separate Part1 and Part2)
If anyone could please help me out it would be of great help.
Thanks!
Solved! Go to Solution.
hi @newbiepbix
Just use this logic to create a new table
New Table =
SUMMARIZE (
'Table',
'Table'[Title],
"Type", IF (
"Both" IN VALUES ( 'Table'[Type] ),
"Both",
IF (
"Part1 only" IN VALUES ( 'Table'[Type] )
&& "Part2 only" IN VALUES ( 'Table'[Type] ),
"Both",
IF (
"Part1 only" IN VALUES ( 'Table'[Type] ),
"Part1 only",
IF ( "Part2 only" IN VALUES ( 'Table'[Type] ), "Part2 only", "NA" )
)
)
)
)
Result:
and here is sample pbix file, please try it.
Regards,
Lin
hi @newbiepbix
Just use this logic to create a new table
New Table =
SUMMARIZE (
'Table',
'Table'[Title],
"Type", IF (
"Both" IN VALUES ( 'Table'[Type] ),
"Both",
IF (
"Part1 only" IN VALUES ( 'Table'[Type] )
&& "Part2 only" IN VALUES ( 'Table'[Type] ),
"Both",
IF (
"Part1 only" IN VALUES ( 'Table'[Type] ),
"Part1 only",
IF ( "Part2 only" IN VALUES ( 'Table'[Type] ), "Part2 only", "NA" )
)
)
)
)
Result:
and here is sample pbix file, please try it.
Regards,
Lin
Thank you so much!!!! This worked like a charm.
@newbiepbix , create a new measure like this and try
new measure =Switch(
countx(filter(table,table[Type]="Both"),table[Title])>=1,"Both",
countx(filter(table,table[Type]="Part1 AND Part2"),table[Title])>=1,"Part1 AND Part2",
countx(filter(table,table[Type]="Part1"),table[Title])>=1,"Part1",
countx(filter(table,table[Type]="Part 2"),table[Title])>=1,"Part 2",
"NA"
)
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 |
|---|---|
| 45 | |
| 43 | |
| 39 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 67 | |
| 66 | |
| 31 | |
| 28 | |
| 24 |