Forum Discussion
Anonymous
8 years agoNot applicable
Delta Calculation strange results
Hi there, I have two tables in my SQL Server 2017 The CurrentMemberYr produce the expected results but The CurrentMemberBr with the slicer did not as you can see in the attachment How do I fix ...
- 8 years ago
Hello Anonymous
Can you please try the following query and let me know if it works?
SELECT
Branch,
Years,
CurrentMembers, CASE
WHEN Branch != LAG(Branch, 1) OVER (ORDER BY Branch, Years) THEN NULL ELSE CurrentMembers - LAG(CurrentMembers,1) OVER (ORDER BY Branch, Years)
END AS Delta FROM CurrentMemberBr ORDER BY Branch, Years
quentin_vigne
Solution Sage
8 years agoHi Anonymous
Did you add a relationship between your two tables in the relationship tab ?
If not you should probably add a new one on an PK value.
Also check if it is a bidirectionnal filter between them
- Quentin
Anonymous
8 years agoNot applicable
Quentin,
No, there is no connection between them. Table CurrentMemberYr is to show what the currect value looks like (expected results)
Table CurrentMemberBr show the error, I think I need to add dynamic parameter and convert the code to a stored proc
Thanks,
Ed Dror