Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Data and Expected Result below[^]
Please check the picture file attached. I want to get distinct sum of a column(Promotion Amount) based on another column(Promotion Name). At SSRS. Cannot do this grouping sum at t-sql Level .. Need to be done in SSRS only.. through expression.

Thanks in Advance
Posted

1 solution

Hello,

you Can achieve this adding a ROW_NUMBER() function my SQL query

IN SQL :

SQL
SELECT PromotionName,PromotionAmount, Spent, ROW_NUMBER() OVER (PARTITION BY PromotionName ORDER BY PromotionName ASC) AS Rank FROM Table


IN SSRS :

=SUM(IIF(Rank = 1, PromotionAmount.Value, 0))
 
Share this answer
 
Comments
JWhiteLion 3-Nov-17 7:48am    
Solución perfecta!!
Member 14631050 12-Feb-21 1:18am    
Thanks a lot, made my work :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900