简体   繁体   English

LoD 表达式,用于计算 Tableau 中基于另一个维度 id 的一个维度 id 的平均计数

[英]LoD expression to calculate the average count of one dimension id based on another dimension id in Tableau

I have a dataset consisting of unique trips (IDs), users_id, and bikes_id and time-stamp trips_id, users_id, and bikes_id are dimensions:我有一个由唯一旅行 (ID)、users_id 和 bikes_id 组成的数据集,时间戳 trips_id、users_id 和 bikes_id 是维度:

  1. A trip_id is unique trip_id 是唯一的
  2. A user can have multiple bikes_id and trips_id一个用户可以有多个 bikes_id 和 trips_id
  3. A bike can have multiple rides and multiple users一辆自行车可以有多个骑行和多个用户

I would like to show how many rides there are (on average) per user, how many bikes are used (on average) by user and how many rides there are per bike.我想显示每个用户(平均)有多少次骑行,用户(平均)使用了多少辆自行车以及每辆自行车有多少次骑行。 Is there a calculated field or LoD that can do this calculations?是否有可以进行此计算的计算字段或 LoD? So I can show per week, month or another time period?所以我可以每周、每月或其他时间段显示?

I would like to show how many rides there are (on average) per user我想显示每个用户(平均)有多少游乐设施

use this CF (average for whole data)使用这个 CF(整个数据的平均值)

{AVG({FIXED [USER] : COUNTD(TRIP_ID)})}

how many bikes are used (on average) by user用户(平均)使用了多少辆自行车

use this用这个

{AVG({FIXED [user]: countd(bike_id)})}

how many rides there are per bike每辆自行车有多少次骑行

use this用这个

{AVG({FIXED [bike_id]: countd(trip_id)})}

NOTE these calcs will give you average for whole dataset注意这些计算会给你整个数据集的平均值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM