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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Dynamic Column

 

Hi All,

 

I have the three coluns in my report mentioned below:

 

Is there a way that I can tranform them so that the end result can look like a column1 : ForecastedGrossRevenue Jan'2013, column 2: ForecastedGrossRevenue Feb'2013 and so on.

 

I want the data to be shown horizontally.

 

Himanshu_13_0-1616595744731.png

 

Regards,

Himanshu

1 ACCEPTED SOLUTION

Hi, @Anonymous 

Sorry, I just missed one step before creating the custom column, you should first go to change the type of the column [EXPECTINMONTH] to “Text”:

v-robertq-msft_0-1617155147523.png

 

Then you can add the custom column and check if it can work, you should also make sure the column name is same as yours in the expression.

 

Best Regards,

Community Support Team _Robert Qin

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

4 REPLIES 4
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, I can roughly understand your requirement, I think you can achieve this in the Power Query editor, you can try my steps:

  1. Create a custom column like this:

v-robertq-msft_0-1617010064121.png

 

  1. Remove other columns except these two columns, then click “Piovit columns” and select like this:

v-robertq-msft_1-1617010064128.png

 

  1. Then click “Apply and close”, and you can get what you want, like this:

v-robertq-msft_2-1617010064130.png

 

This is my M code in the advanced editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwNNa10DVU0gEyTQyMgbSZoZ6RoVKsDlTSEixpaGluYgqkTS11jEwQkoYG2LTGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [EXPECTINMONTH = _t, FORECASTEDUSAGE = _t, ForecastedGrossRevenue.1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"EXPECTINMONTH", type date}, {"FORECASTEDUSAGE", Int64.Type}, {"ForecastedGrossRevenue.1", type number}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"ForecastedGrossRevenue.1", "ForecastedGrossRevenue"}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"EXPECTINMONTH", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each "ForecastedGrossRevenue "&[EXPECTINMONTH]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"EXPECTINMONTH", "FORECASTEDUSAGE"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Custom]), "Custom", "ForecastedGrossRevenue", List.Sum)
in
    #"Pivoted Column"

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

Anonymous
Not applicable

I'm getting an error while creating the custom column.

 

Himanshu_13_0-1617098233729.png

 

Hi, @Anonymous 

Sorry, I just missed one step before creating the custom column, you should first go to change the type of the column [EXPECTINMONTH] to “Text”:

v-robertq-msft_0-1617155147523.png

 

Then you can add the custom column and check if it can work, you should also make sure the column name is same as yours in the expression.

 

Best Regards,

Community Support Team _Robert Qin

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

amitchandak
Super User
Super User

@Anonymous , One Option, is unpivot the last two columns

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

 

Second is in matrix use "Show on row", But that will give , Feb 2021, Revene

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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