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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Generate table with 3x columns from other table with 6 columns

Hey, I have the following problem shown in the picture.

I need to solve it with DAX language.

Are formulas useful here  like
A) Generateseries 
B) Addcolumns( Summarize ( ) ) 

 

How do I create this new table?

 

Situation and desired output QUESTION.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
UNION(
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost Alex","Cost",'Table'[Cost Alex]),
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost Ben","Cost",'Table'[Cost Ben]),
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost Cris","Cost",'Table'[Cost Cris]),
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost David","Cost",'Table'[Cost David]),
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost Eric","Cost",'Table'[Cost Eric]))

2. Click [Year] to set as Sort ascending.

vyangliumsft_0-1628235103255.png

3. Result:

vyangliumsft_1-1628235103259.png

 

Best Regards,

Liu Yang

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

3 REPLIES 3
Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
UNION(
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost Alex","Cost",'Table'[Cost Alex]),
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost Ben","Cost",'Table'[Cost Ben]),
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost Cris","Cost",'Table'[Cost Cris]),
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost David","Cost",'Table'[Cost David]),
    SELECTCOLUMNS('Table',"Year",'Table'[Year],"Employee","Cost Eric","Cost",'Table'[Cost Eric]))

2. Click [Year] to set as Sort ascending.

vyangliumsft_0-1628235103255.png

3. Result:

vyangliumsft_1-1628235103259.png

 

Best Regards,

Liu Yang

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

Anonymous
Not applicable

Hi @FrankAT 

 

unfortunatelly PowerQuery is not an option, as the initial table is already an extra table which was created with DAX.
I am looking for an DAX solution.

FrankAT
Community Champion
Community Champion

Hi @Anonymous ,

the easiest, shortes an best way to get the desired result is to use Power Query. Unpivot the Cost columns.

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.