博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Informatica中实现count(distinct)
阅读量:4209 次
发布时间:2019-05-26

本文共 1039 字,大约阅读时间需要 3 分钟。

Thanks for your response. Here is the sample data information: 


A id1 $200 

A id1 $300 

A id2 $150 

B id3 $100 

B id4 $20 


I want the following in the output: 

Name distinct-Count Totalamt 

A 2 $650 

B 2 $120 

One way to do this is to use 2 aggregators. The First aggregator group and sum amt by Name and ID. 

On the second aggregator group by Name and count id and sum amt.

So if I remove the duplicate row in the Sorter I will get incorrect distinct-count and totalamt for "A".

There are two different ways. 

1) Suggested by Manas - to use two aggregates. 
2)Flaging the record as 1 and 0 before aggregate. For this, you should have sorted data on name and id. 
If you have sorted data coming from source, try 2nd option as given below. 
In expression transformation before aggregator. 

IN_ID 
v_ID_CNT = IIF(ISNULL(v_ID) Or IN_ID!= V_ID,1, 0) 
O_ID_CNT=V_ID_CNT 
V_ID=IN_ID 

O_ID_CNT will go in to your aggregator. 

You need to create one more port in aggregator for SUM(O_ID_CNT) which will return the distinct count of IDs. 
(No change in GROUP BY columns)

转载地址:http://ozrli.baihongyu.com/

你可能感兴趣的文章
java反射详解
查看>>
JPA 注解
查看>>
JQuery 简介
查看>>
Java创建对象的方法
查看>>
Extjs自定义组件
查看>>
TreeGrid 异步加载节点
查看>>
Struts2 标签库讲解
查看>>
Google Web工具包 GWT
查看>>
材料与工程学科相关软件
查看>>
MPI的人怎么用仪器
查看>>
windows 下AdNDP 安装使用
查看>>
Project 2013项目管理教程(1):项目管理概述及预备
查看>>
ssh客户端后台运行
查看>>
哥去求职,才说了一句话考官就让我出去
查看>>
【React Native】把现代web科技带给移动开发者(一)
查看>>
【GoLang】Web工作方式
查看>>
Launch Sublime Text 3 from the command line
查看>>
【数据库之mysql】mysql的安装(一)
查看>>
【数据库之mysql】 mysql 入门教程(二)
查看>>
【HTML5/CSS/JS】A list of Font Awesome icons and their CSS content values(一)
查看>>