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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Trying to create a column per year

Hi Guys!

 

I do haven issue, I've been told to make a column based on another column call month_id.

Basically it's the combine of year and month.

 

monthyear.PNG

 

And I need to make a table like this one below.  Adding a column per mes_id.

 

Segment202001202002
S1.00001.2300
S2.002341.009134

 

I tried by pivot but not sure yet how it works.

Does anybody have  an idea how can I reach this result?

 

Thanks for the help!

 
 
1 ACCEPTED SOLUTION
edhans
Super User
Super User

You can by using the Pivot Column feature in the Transpose tab of Power Query but I recommend against it. It will make your life miserable when trying to create visuals and measures in DAX. Plus, if you have thousands or millions of rows, it won't pivot. It will just throw an error.

 

Pull your data in as is. Then add a Matrix visual, and add the mes_id column to the Columns setting, Segments to the rows, and your data to the values. It will just work.

 

If that doesn't help, please share a PBIX file with some sample data so we can see the entire picture. Your sample image for example doesn't have the data you want in your expected result, so it is kinda hard to ensure a proposed solution will work.

 

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
edhans
Super User
Super User

You can by using the Pivot Column feature in the Transpose tab of Power Query but I recommend against it. It will make your life miserable when trying to create visuals and measures in DAX. Plus, if you have thousands or millions of rows, it won't pivot. It will just throw an error.

 

Pull your data in as is. Then add a Matrix visual, and add the mes_id column to the Columns setting, Segments to the rows, and your data to the values. It will just work.

 

If that doesn't help, please share a PBIX file with some sample data so we can see the entire picture. Your sample image for example doesn't have the data you want in your expected result, so it is kinda hard to ensure a proposed solution will work.

 

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

I tryied the matrix thing an it works perfectly.

 

I was sure that the solution was easy but didn't know how to do it.

 

Thank you for the help!

 

 

Grettings

Excellent! Glad your project is moving forward.


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.