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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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