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
Anonymous
Not applicable

Plot residual value

Hi 

 

I have a data source like this, 

PNIDDateVal
PN_1User_1wk_10.2
PN_1User_1wk_20.4
PN_1User_1wk_30.6
PN_1User_2wk_20.4
PN_1User_2wk_30.4
PN_2User_1wk_10.2
PN_2User_2wk_10.2
PN_2User_2wk_20.2
PN_2User_3wk_20.4
PN_2User_3wk_30.4

 

The report has a date slicer and will have a pie chart to show the PN against Val values. When a different ID is selected, the pie chart will display the PN and the Val. As the Val value summation for each user may not always be 1 in each week, I want to have the "residual" value to be plotted in the pie or created in the table. 

In my mind, I expect the final data to be like the table below, those rows of in blue are created by some tricks in Power BI. 

PNIDDateVal
PN_1User_1wk_10.2
PN_1User_1wk_20.4
PN_1User_1wk_30.6
PN_1User_2wk_20.4
PN_1User_2wk_30.4
PN_2User_1wk_10.2
PN_2User_2wk_10.2
PN_2User_2wk_20.2
PN_2User_3wk_20.4
PN_2User_3wk_30.4
ResUser_1wk_10.6
ResUser_1wk_20.6
ResUser_1wk_30.8
ResUser_2wk_10.8
ResUser_2wk_20.4
ResUser_2wk_30.6
ResUser_3wk_11
ResUser_3wk_20.6
ResUser_3wk_30.6

 

I can calculate the residual value but I cannot figure out a way to make this residual value to be included to the table and associate with Res which wasn't inputted in the original data. I am not sure this is something can be done by the visualisation or DAX, hence, any guidance and tip will be much appreciated.

 

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

I think I would generate these "res" records using PowerQuery. 

 

You can do this by

  • Right click on your existing query and choose Reference to create a new query that references the current one.
  • Then remove the PN column and group by date and id and sum the Val column
  • Create a new Val column that is 1 - Val
  • Then Add "Res" as a constant value for a new PN column
  • Then append the existing query to this new one
  • Finally right click on the original query and disable the load

 

You can find a working example of the above steps in the attached pbix file

View solution in original post

2 REPLIES 2
d_gosbell
Super User
Super User

I think I would generate these "res" records using PowerQuery. 

 

You can do this by

  • Right click on your existing query and choose Reference to create a new query that references the current one.
  • Then remove the PN column and group by date and id and sum the Val column
  • Create a new Val column that is 1 - Val
  • Then Add "Res" as a constant value for a new PN column
  • Then append the existing query to this new one
  • Finally right click on the original query and disable the load

 

You can find a working example of the above steps in the attached pbix file

Anonymous
Not applicable

Thanks, d_gosbell.

This exactly gives me what I need.

 

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.