Forum Discussion
Ciapek
Mar 13, 2024Copper Contributor
DataSet - How to retrieve values from grouped columns?
I have SQL which return data: SELECT dbo.TOWARY.TWR_NUMER AS INDEKS, dbo.TOWARY.TWR_NAZWA AS NAZWA, dbo.SL_JM.SLJM_KOD AS JM, SUM (dbo.WAZENIA.WZN_ILOSC * dbo.WZN_CNY.WZNCNY_NETTO) / SUM (dbo.WA...
ih_bbb
May 23, 2024Copper Contributor
If it is me, I will get the value of each year in the query itself, bring back as part of the result set. Then, you can just do the division using the 2 columns in the report. There are few ways to do it in query. You can use temp table, or CTE. Good luck.
- CiapekMay 29, 2024Copper Contributor
Counting in SQL is not necessary, solution is simple:
=IIF(
(Previous(Sum(Fields!CENA.Value), "ROK") = 0 OR
Sum(Fields!CENA.Value) = 0),
"-",
(
Sum(Fields!CENA.Value) -
IIF(
Previous(Sum(Fields!CENA.Value), "ROK") = 0,
Sum(Fields!CENA.Value),
Previous(Sum(Fields!CENA.Value), "ROK")
))
/
IIF(
Previous(Sum(Fields!CENA.Value), "ROK") = 0,
Sum(Fields!CENA.Value),
Previous(Sum(Fields!CENA.Value), "ROK")
)
)