Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Mars3442
Helper I
Helper I

Pivot multiple value

Hi everyone,

I want to ask for help solving my problem

 

I have a table like this

Mars3442_0-1705980948624.png

I need to group the vehicle based on customer and period

 

My expectation table like this

Mars3442_0-1705981147160.png

 

What should I do if I want to get my expectation table?

 

Please help me to solve this problem

 

Thank you..

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Mars3442 ,

Please follow these steps:

1.Create a calculation table and write the following expression.

Table 2 =

var _table1=

DISTINCT('Table'[Customer])

return

ADDCOLUMNS(

    _table1,

    "M01",

    CONCATENATEX(

        FILTER(ALL('Table'),

       'Table'[Customer]=EARLIER('Table'[Customer])&&'Table'[Period]=1),'Table'[Vehicle],","),

    "M02",

      CONCATENATEX(

        FILTER(ALL('Table'),

       'Table'[Customer]=EARLIER('Table'[Customer])&&'Table'[Period]=2),'Table'[Vehicle],",")

   

)

2.The result obtained is shown below.

vkaiyuemsft_0-1705992062663.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

slorin
Super User
Super User

Hi,

1. Transform "Period" 1, 2, ... --> M01, M02, ...

2. Pivot with Text.Combine

 

let
Source = Your_Source,
Period = Table.TransformColumns(Source, {{"Period", each "M" & Number.ToText(_, "00"), type text}}),
Pivot = Table.Pivot(Period, List.Distinct(Period[Period]), "Period", "Vehicle", each Text.Combine(_, ", "))
in
Pivot

Stéphane

 

View solution in original post

2 REPLIES 2
slorin
Super User
Super User

Hi,

1. Transform "Period" 1, 2, ... --> M01, M02, ...

2. Pivot with Text.Combine

 

let
Source = Your_Source,
Period = Table.TransformColumns(Source, {{"Period", each "M" & Number.ToText(_, "00"), type text}}),
Pivot = Table.Pivot(Period, List.Distinct(Period[Period]), "Period", "Vehicle", each Text.Combine(_, ", "))
in
Pivot

Stéphane

 

Anonymous
Not applicable

Hi @Mars3442 ,

Please follow these steps:

1.Create a calculation table and write the following expression.

Table 2 =

var _table1=

DISTINCT('Table'[Customer])

return

ADDCOLUMNS(

    _table1,

    "M01",

    CONCATENATEX(

        FILTER(ALL('Table'),

       'Table'[Customer]=EARLIER('Table'[Customer])&&'Table'[Period]=1),'Table'[Vehicle],","),

    "M02",

      CONCATENATEX(

        FILTER(ALL('Table'),

       'Table'[Customer]=EARLIER('Table'[Customer])&&'Table'[Period]=2),'Table'[Vehicle],",")

   

)

2.The result obtained is shown below.

vkaiyuemsft_0-1705992062663.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.