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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
yaudje
Frequent Visitor

Transpose a table

Hi Folks,

 

Im having a hard time transposing the table. Just need the Dax for the  Output Table basis the Source table. Your response will be a big help. Help.png

 

Thanks in advance.

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @yaudje ,

 

This is better done on Power Query using the Unpivot option however in dax you can use the following code:

 

Table 2 = UNION(
    SELECTCOLUMNS('Table', "Sales", 'Table'[Sales],"Area", 'Table'[Area], "Year", 2019, "value", 'Table'[2019]), 
    SELECTCOLUMNS('Table',"Sales", 'Table'[Sales],"Area", 'Table'[Area], "Year", 2020, "value", 'Table'[2020]),
   SELECTCOLUMNS('Table',"Sales", 'Table'[Sales],"Area", 'Table'[Area], "Year", 2021, "value", 'Table'[2021]))

 

MFelix_0-1668090227607.pngMFelix_1-1668090236423.png

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @yaudje ,

 

This is better done on Power Query using the Unpivot option however in dax you can use the following code:

 

Table 2 = UNION(
    SELECTCOLUMNS('Table', "Sales", 'Table'[Sales],"Area", 'Table'[Area], "Year", 2019, "value", 'Table'[2019]), 
    SELECTCOLUMNS('Table',"Sales", 'Table'[Sales],"Area", 'Table'[Area], "Year", 2020, "value", 'Table'[2020]),
   SELECTCOLUMNS('Table',"Sales", 'Table'[Sales],"Area", 'Table'[Area], "Year", 2021, "value", 'Table'[2021]))

 

MFelix_0-1668090227607.pngMFelix_1-1668090236423.png

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





yaudje
Frequent Visitor

SUper thanks. This one works:-) Cheers mate/

Don't forget to accept the correct answer so it can help others

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 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.