Forum Discussion
Split 1 Column to 3 Column based on parent
- 6 years ago
hi Anonymous
The formula is for calculated column, not custom column in edit queries.
Please download my sample pbix file and see the details in it.
Regards,
Lin
hi Anonymous
For your case, you could try this way as below:
Step1:
Add a conditional column that which row is Top, Middle, Bottom by this formula like below:
Type = var _toptable=CALCULATETABLE(VALUES('Table'[Product.Id]),ALLEXCEPT('Table','Table'[LinkID]),'Table'[Parent]=BLANK()) return
var _Middletable=CALCULATETABLE(VALUES('Table'[Product.Id]),FILTER(ALLEXCEPT('Table','Table'[LinkID]),'Table'[Parent] in _toptable) ) return
var _Bottomtable=CALCULATETABLE(VALUES('Table'[Product.Id]),FILTER(ALLEXCEPT('Table','Table'[LinkID]),'Table'[Parent] in _Middletable) ) return
IF('Table'[Product.Id] in _toptable,"Top",IF('Table'[Product.Id] in _Middletable,"Middle",IF('Table'[Product.Id] in _Bottomtable,"Bottom")))
Then use this formula to create a New table
New table =
SUMMARIZE (
'Table',
'Table'[LinkID],
"Top", CALCULATE (CONCATENATEX ( VALUES ( 'Table'[Product] ), [Product], "," ), FILTER ( 'Table', 'Table'[Type] = "Top" )),
"Middle", CALCULATE (CONCATENATEX ( VALUES ( 'Table'[Product] ), [Product], "," ),FILTER ( 'Table', 'Table'[Type] = "Middle" )),
"Bottom", CALCULATE (CONCATENATEX ( VALUES ( 'Table'[Product] ), [Product], "," ),FILTER ( 'Table', 'Table'[Type] = "Bottom" ))
)
Result:
and here is sample pbix file, please try it.
Regards,
Lin
- Anonymous6 years agoNot applicable
Hi v-lili6-msft
All looking good, I have started to follow your steps but when I am creating the custom column I get the below error;
Thank you for your help
- v-lili6-msft6 years ago
Community Support
hi Anonymous
The formula is for calculated column, not custom column in edit queries.
Please download my sample pbix file and see the details in it.
Regards,
Lin
- Anonymous6 years agoNot applicable
Great, yes I see now thank you very much and it all worked