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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
cmajewsk
Helper I
Helper I

Unpivoted columns causing issues in calculations

My source is a spreadsheet with projects that have budgets over multiple years. See this thread and I was able to unpivot the columns so when I clicked the slicer for each year I was able to get only those totals. 

Project Name

2023

2024

2025

Total

Project 1

400

500

500

1400

Project 2

300

700

100

1100

 

 Now my spreadsheet has a few more calculated columns like: Spent, and Remaining 

Project Name

2023

2024

2025

Total

Spent

Remaining

Project 1

400

500

500

1400

400

1000

Project 2

300

700

100

1100

100

1000

 

However, due to the Year columns being unpivoted the Spent and Remaining columns are not calculating in PBI correctly. In fact, the columns are adding the value for each year it is showing up in the Data tab, so it's looks like this in the PBI Table visual. 

Project Name

2023

2024

2025

Total

Spent

Remaining

Project 1

400

500

500

1400

1200

200

Project 2

300

700

100

1100

300

800

 

I tried using a measure for these, but I am getting the same results. I also tried removing the unpivot and then unpivitong the original year columns and also the Spent and Remaining Columns, but this didn't help.

 

If select "Don't Summarize" the values will display correctly however, then the totals at the bottom of the Table visual will not display as they are not summed. 

 

Any suggestions would be appreciated.

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @cmajewsk 

 

You can try the following methodsSelect the three columns except the year-Unpivot Other columns:

vzhangti_0-1701409756021.png

vzhangti_1-1701409781118.png

Result:

vzhangti_2-1701409965432.pngvzhangti_3-1701409974647.png

Is this the result you expect? If not, please advise what output you expect.

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @cmajewsk 

 

You can try the following methodsSelect the three columns except the year-Unpivot Other columns:

vzhangti_0-1701409756021.png

vzhangti_1-1701409781118.png

Result:

vzhangti_2-1701409965432.pngvzhangti_3-1701409974647.png

Is this the result you expect? If not, please advise what output you expect.

 

Best Regards,

Community Support Team _Charlotte

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

 

cmajewsk
Helper I
Helper I

I used the SUMX and GROUPBY functions located in this post to create measures and it seems to be working as long as there is data in the unpivoted rows. For example, it was not adding one specific row. As there were no values in the Years columns in that row, as there is no budget in any of the years. However, there is still total cost column as there was money spent in years past, so I added a 1 in one of the current years and it counts that row. I am still looking over the data to see if it’s accurate when summing at the bottom of the Table visual, as I am using this function to generate the Spent, Remaining and Estimated Total Cost.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.