Forum Discussion
separate values into columns
- 1 year ago
Like this? Pbix file attached.
- 1 year ago
Hi, if you have space in Promoted Headers, you have to use #"Promoted Headers" as reference so replace Values step with this:
= List.Buffer(List.Sort(List.Distinct(#"Promoted Headers"[StateOfProceedingID])))
Could you explain it in detail please? I don't understand why do you need that. There is no "open" value in [StateOfProceedingID] column.
If you want to add new column for each row with values from [StateOfProceedingID] column do this:
let
Source = Excel.Workbook(File.Contents("C:\Downloads\PowerQueryForum\jomask\Book1.xlsx"), true, true),
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
States = List.Distinct(Sheet1_Sheet[StateOfProceedingID]),
StepBack = Sheet1_Sheet,
Ad_CaseColumns = List.Accumulate(
{0..List.Count(States)-1},
StepBack,
(s,c)=> Table.AddColumn(s, "Case " & Text.From(c+1), (x)=> States{c}, type text))
in
Ad_CaseColumns
If you want add 5 columns with values None, Closed, Enchanced, Open, Pending - use this:
let
Source = Excel.Workbook(File.Contents("C:\Downloads\PowerQueryForum\jomask\Book1.xlsx"), true, true),
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
Ad_CaseColumns = [ values = {"None", "Closed", "Enchanced", "Open", "Pending"},
la = List.Accumulate(
List.Zip({ {0..List.Count(values)-1}, values }),
Sheet1_Sheet,
(s,c)=> Table.AddColumn(s, "Case " & Text.From(c{0}+1), (x)=> c{1}, type text))
][la]
in
Ad_CaseColumns
Don't forget to replace address to your excel file.
Hello Thank you for a response. I know there is no "open" just quickly created a sample and snipped a picture. I would like those "values"(I turned them into the non-digital text, originally they are digital 1,2,3,4 each number belongs to Closed, enhanced...) Closed, enhanced, none, stand put the next each other in columns in Power BI with a Column names "case 1", "case 2", "case 3" and "case 4". The picture in Excel ( only for explanation my idea) with the red arrow is what I need in Power Bi.
- dufoq31 year agoCommunity Champion
Like this? Pbix file attached.
- jomask1 year agoFrequent Visitor
Yes that's the one
- jomask1 year agoFrequent Visitor
Thank you
- dufoq31 year agoCommunity Champion
You're welcome.
- jomask1 year agoFrequent Visitor
Hello, one more question , I would liked to do a Pie chart from the Case column. It would show(count) Case1,Case2,Case3,Case4,Case5. How can I do that? Once again Thank you