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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Summitreached
Frequent Visitor

Create a new table pivot from calculated columns

Hi,

 

I am very new to this but trying to convert the following table where JAN - DEC are calculated columns:

 

ResourceJanFebMarAprMayJunJulAugSepOctNovDec
A0.51.50.10.10.30.30.30.30.30.30.32
B0.10.10.30.30.30.30.30.30.3211
A0.50.30.10.10.10.30.30.30.30.30.30.3
B0.51.50.10.10.30.30.30.30.30.30.32
etc            

 


into the following: 

 

ResourceMonthValue
AJan1
AFeb1.8
AMar0.2
AApr0.2
AMay0.4
AJun0.6
AJul0.6
AAug0.6
ASep0.6
AOct0.6
ANov0.6
ADec2.3
BJan0.6
BFeb1.6
BMar0.4
BApr0.4
BMay0.6
BJun0.6
BJul0.6
BAug0.6
BSep0.6
BOct2.3
BNov1.3
BDec3

 

 

Note I am ok if Resource is repeated for each instance of Month i.e. two values for Jan for Resource A


I cannot use a query as I have calculated columns and have tried DAX to pivot as follows... but get multiple repeats

 

NewTable=

UNION (

    SELECTCOLUMNS (

        OldTableName,

        "Value", OldTableName[Jan],

        "Month", "Jan",

        "Resource", OldTableName[Resource]

    ),

    SELECTCOLUMNS (

       

OldTableName,

        "Value", OldTableName[Feb],

        "Month", "Feb",

        "Resource", OldTableName[Resource]

    ), etc...

 

Any help greatly appreciated!

 

Killian

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Summitreached,

 

If this is a case, you can try to add a distinct function outside of your formula, this function also works on table.

NewTable=
DISTINCT(
UNION (
    SUMMARIZE(
        OldTableName,
        OldTableName[Resource],
        "Month", "Jan",
	"Value", OldTableName[Jan]
    ),

    SUMMARIZE(
		OldTableName,
        	OldTableName[Resource],
		"Month", "Feb",
        	"Value", OldTableName[Feb]
    ), etc...
)

 

 

Regards,

Xiaoxin Sheng

View solution in original post

Hi Xiaoxin,

 

That worked perfectly!

 

Many thanks again,

Killian 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Summitreached,

 

You can try to use unpivot table function and remove duplicate function to convert these records.

 

Steps:

 

1. Click on edit queries button to enter query editor.
2. Select month columns and click on unpivot table.

9.PNG10.PNG


3. All select table and click on remove duplicate button.

13.png

12.PNG

 

Regards,

Xiaoxin Sheng

Hi Xiaoxin,

 

Thank you for the quick response. Unfortunately calculated columns do not appear in the Query editor.

 

Regards,

Killian

Anonymous
Not applicable

Hi @Summitreached,

 

Can you share the sample data to analysis and write the formula?

 

Regards,

Xiaoxin Sheng

Hi Xiaoxin,

 

All the information is given above.

 

Thanks again,

Killian

Anonymous
Not applicable

Hi @Summitreached,

 

If this is a case, you can try to add a distinct function outside of your formula, this function also works on table.

NewTable=
DISTINCT(
UNION (
    SUMMARIZE(
        OldTableName,
        OldTableName[Resource],
        "Month", "Jan",
	"Value", OldTableName[Jan]
    ),

    SUMMARIZE(
		OldTableName,
        	OldTableName[Resource],
		"Month", "Feb",
        	"Value", OldTableName[Feb]
    ), etc...
)

 

 

Regards,

Xiaoxin Sheng

Hi Xiaoxin,

 

That worked perfectly!

 

Many thanks again,

Killian 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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