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
miwundu
Helper I
Helper I

Help with SSRS Expression

I have 2 datasets in my report but using a common table. dataset 1 is named XXX and dataset 2 is named UNKNOWN . I have a column cell_1 with this ssrs lookup expression from dataset XXX

=Sum(Fields!total_complete_1_Count.Value, "XXX") + Sum(Fields!total_complete_2_Count.Value, "XXX") + Sum(Fields!total_complete_3_Count.Value, "XXX") and

 another column cell_2 from Unknown dataset with this expression 

Sum(Fields!total_complete_1_Count.Value) + Sum(Fields!total_complete_2_Count.Value) + Sum(Fields!total_complete_3_Count.Value).

 

I want to divide cell_1 by cell_2.  XXX EXPRESSION DISPLAYS correctly but unknown displays a wrong value

=Sum(Fields!total_complete_1_Count.Value, "XXX") + Sum(Fields!total_complete_2_Count.Value, "XXX") + Sum(Fields!total_complete_3_Count.Value, "XXX") / 

Sum(Fields!total_complete_1_Count.Value, "UNKNOWN") + Sum(Fields!total_complete_2_Count.Value, "UNKNOWN") + Sum(Fields!total_complete_3_Count.Value, "UNKNOWN").
The value for cell displays correctly but cell 2 does not so the result is wrong. I have also tried to use the numerator and denominator in text boxes properly named and then call them in this expression
=CD(Reportitems!XXX_Sum.Value) / CD(Reportitems!UNKNOWN_Sum.Value). 

THESE ARE THE TEXT BOX NAMES XXX_Sum AND UNKNOWN_Sum.

I am not sure what I am doing wrong

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @miwundu 

Based on the expression you provided, I created the following sample data:

vjianpengmsft_0-1723002659480.png

In Report builder I have the following two Dataset:.

vjianpengmsft_1-1723002688686.png

I use the following expression to find dataset xxx.

=Sum(Fields!total_complete_1_Count.Value, "XXX") + Sum(Fields!total_complete_2_Count.Value, "XXX") + Sum(Fields!total_complete_3_Count.Value, "XXX")

vjianpengmsft_2-1723002727452.png

I use the following expression to find dataset xxx and dataset UNKNOWN:

= (Sum(Fields!total_complete_1_Count.Value, "XXX") + Sum(Fields!total_complete_2_Count.Value, "XXX") + Sum(Fields!total_complete_3_Count.Value, "XXX")) / 
  (Sum(Fields!total_complete_1_Count.Value, "UNKNOWN") + Sum(Fields!total_complete_2_Count.Value, "UNKNOWN") + Sum(Fields!total_complete_3_Count.Value, "UNKNOWN"))

vjianpengmsft_3-1723002815175.png

The results are as follows:

vjianpengmsft_4-1723002843578.png

 

 

Best Regards

Jianpeng Li

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

1 REPLY 1
Anonymous
Not applicable

Hi, @miwundu 

Based on the expression you provided, I created the following sample data:

vjianpengmsft_0-1723002659480.png

In Report builder I have the following two Dataset:.

vjianpengmsft_1-1723002688686.png

I use the following expression to find dataset xxx.

=Sum(Fields!total_complete_1_Count.Value, "XXX") + Sum(Fields!total_complete_2_Count.Value, "XXX") + Sum(Fields!total_complete_3_Count.Value, "XXX")

vjianpengmsft_2-1723002727452.png

I use the following expression to find dataset xxx and dataset UNKNOWN:

= (Sum(Fields!total_complete_1_Count.Value, "XXX") + Sum(Fields!total_complete_2_Count.Value, "XXX") + Sum(Fields!total_complete_3_Count.Value, "XXX")) / 
  (Sum(Fields!total_complete_1_Count.Value, "UNKNOWN") + Sum(Fields!total_complete_2_Count.Value, "UNKNOWN") + Sum(Fields!total_complete_3_Count.Value, "UNKNOWN"))

vjianpengmsft_3-1723002815175.png

The results are as follows:

vjianpengmsft_4-1723002843578.png

 

 

Best Regards

Jianpeng Li

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

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.