mysql - How to Sum Value's of a column in a Table using Lookup function
问题描述
I have two Datasets i.e Dataset1 and Dataset 2 both have columns like (System has Similar Values in Both Dataset)
Dataset1-System , work , food
Dataset2-System , total , complete
Value in Column (DATASET2) "Total" is like 1,18,4 and in "Complete" its like 1,0,4.
I want to use Dataset2 in the same Tablix as Dataset1 and I would like to get the result by summing up total and complete
=Lookup(Fields!SYSTEM.Value ,Fields!SYSTEM.Value, Fields!COMPLETE.Value , "DATASET2"))/Lookup(Fields!SYSTEM.Value ,Fields!SYSTEM.Value, Fields!TOTAL.Value,"DATASET2"))
Tried this as well as included SUM in both like
=SUM(Lookup(Fields!SYSTEM.Value ,Fields!SYSTEM.Value, Fields!COMPLETE.Value , "MANI"))/SUM(Lookup(Fields!SYSTEM.Value ,Fields!SYSTEM.Value, Fields!TOTAL.Value,"DATASET2"))
Tried more combinations Nothing Worked
Required result:- " SUM(TOTAL)/SUM(COMPLETE) "
using LOOKUP
How can I achieve it?
解决方案
You're on the right track, but just looks like you're using the wrong function. Also, you may be using too many parenthesis in the top expression. You want to use the SUM
on a LookupSet
function. This will return all the values of COMPLETE
and TOTAL
in a list that you can add together. Try the following expression.
=(SUM(LookupSet(Fields!SYSTEM.Value ,Fields!SYSTEM.Value, Fields!COMPLETE.Value , "DATASET2")))
/(SUM(LookupSet(Fields!SYSTEM.Value ,Fields!SYSTEM.Value, Fields!TOTAL.Value,"DATASET2")))
推荐阅读
- unity3d - 自定义 UI 交互器(XR 交互工具包)
- phpstorm - 如何设置自动保存 PhpStorm?
- .net - .net 应用程序 XHR sql 请求在 30 秒后超时
- unit-testing - 在不同包的测试文件之间共享数据
- html - 将子元素放在兄弟元素之上
- react-native - 使用 React Native 构建可在 Android 和 Windows 10 平台上运行的应用程序
- angularjs - 成功注销后,keycloak 会话未终止
- jquery - 如何使用 jQuery 更改 data-rules-required 的值
- vim - 如何在 Vim 中更改部分变量/函数名
- xslt - 我们如何在 XSLT 中将一个元素称为另一个元素?