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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JR_Lee
Frequent Visitor

Power Query transformation help

I'm struggling to transform the following data:

 

JR_Lee_0-1643363671825.png


so it looks something like the below for each salesperson and each month:

JR_Lee_1-1643363711802.png

this is where i've got to but i cant seem to isolate the month names:

JR_Lee_2-1643363796067.png


Attached xlsx link is here

 

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Hi @JR_Lee ,
1) add a column with the following syntax: "if [Column2] = "Coke[PG 29]" then [Column1] else null
2) Check that new column and fill down values. This will returne a column with the repective months in rows.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

7 REPLIES 7
ImkeF
Community Champion
Community Champion

Hi @JR_Lee ,

you must do that before the unpivoting.
Either before or after the Promoted Headers step:


ImkeF_1-1643375422823.png

 

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

JR_Lee
Frequent Visitor

That works, very cool! Thank you @ImkeF

ImkeF
Community Champion
Community Champion

Hi @JR_Lee ,
1) add a column with the following syntax: "if [Column2] = "Coke[PG 29]" then [Column1] else null
2) Check that new column and fill down values. This will returne a column with the repective months in rows.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

JR_Lee
Frequent Visitor

Hi @ImkeF 

Not sure if I have misundestood but when I add the column I get the following (which inclueds the salesperson name)

JR_Lee_0-1643370318989.png

 

amitchandak
Super User
Super User

@JR_Lee , Unpivot all product columns in power bi

 

https://radacad.com/pivot-and-unpivot-with-power-bi

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandakafter unpivoting all product columns how can i deal with the following:

JR_Lee_0-1643364449347.png

 

@JR_Lee , I think this requires a little bit of clean-up outside power bi, having a month on a column.

 

But check with M expert.

@ImkeF , any suggestion for this

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.