Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tableau api 在tableau桌面上模拟sql查询_Tableau Api - Fatal编程技术网

Tableau api 在tableau桌面上模拟sql查询

Tableau api 在tableau桌面上模拟sql查询,tableau-api,Tableau Api,这是我的sql查询 select id,Achtivation_date,max(Transaxtion_date),Customer_points,count(Transaction-id) from table1 left join tableb b on a.id=b.id group by id,Achtivation_date,Customer_points 我需要在tableau中对此进行模拟,以获得类似于此查询的结果: 从这个工作簿中,我需要这个结果 id ahctivati

这是我的sql查询

select id,Achtivation_date,max(Transaxtion_date),Customer_points,count(Transaction-id) from table1
left join tableb b on a.id=b.id
group by id,Achtivation_date,Customer_points
我需要在tableau中对此进行模拟,以获得类似于此查询的结果:

从这个工作簿中,我需要这个结果

id  ahctivation transaxtion

1 20140102 20140103 2

2  20140303 20140109 3

现在还不完全清楚您希望结果的第三列表示什么(我猜测了该激活的第一个事务时间)。我还猜测,您希望最后一列表示每个id/激活对的行数(忽略事务id)

考虑到这些假设,下面的示例向您展示了两种获得结果的方法,这取决于您是否真的想要第三列

这里没有什么特别复杂的事情,也许只是将事务字段作为离散的度量值,应用MIN()聚合函数,而不是将其作为维度处理

最后,尽管您可以在Tableau数据连接中键入自定义SQL,有时也需要这样做,但通过Tableau数据连接接口选择和连接表通常可以更容易(有时更有效)地获得相同的效果。我在您的查询中没有看到任何需要在Tableau中使用自定义SQL的内容,所以请在需要时保存自定义SQL