Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
490 views
in Technique[技术] by (71.8m points)

Custom sorting table in Google data studio based on table row

Hoping someone can help!

I am trying to custom sort a table in data studio.

Here is the code I am using:

CASE
  WHEN REGEXP_MATCH(Event Label, "(?i)Search cars - button click") THEN 9  
  WHEN REGEXP_MATCH(Event Label, "(?i)Renter - search performed (step 1)") THEN 8 
  WHEN REGEXP_MATCH(Event Label, "(?i)Renter - car details page (step 2)") THEN 7 
  WHEN REGEXP_MATCH(Event Label, "(?i)Renter - instant book - button click (step 3)") THEN 6 
  WHEN REGEXP_MATCH(Event Label, "(?i)Returning Renter - Login (step 4)")THEN 5  
  WHEN REGEXP_MATCH(Event Label, "(?i)Renter - Registration complete (step 4)") THEN 4
  WHEN REGEXP_MATCH(Event Label, "(?i)Renter - extras - continue click (step 5)") THEN 3
  WHEN REGEXP_MATCH(Event Label, "(?i)Renter - payment complete - deposit paid (step 6)") THEN 2  
  WHEN REGEXP_MATCH(Event Label, "(?i)Renter - payment complete - booking confirmed (step 7)") THEN 1  
  ELSE 0
END
question from:https://stackoverflow.com/questions/65901036/custom-sorting-table-in-google-data-studio-based-on-table-row

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Notice your custom field is being treated as a metric:

Sort field

How to notice: Field is blue, and the aggregation function is displayed in the left (=SUM).

This way, the individual numbers of this are being summarized before sorting. In short, to solve your problem, you need to make this field be green (so it is treated as a dimension).

Since I don't have access to your dashboard, I listed some options you may try to follow:

  1. Try to select the field again to check if it appear as green as an option. If so, just select it and you're done;
  2. If you created the custom field as a metric instead of a field, try to delete it and create again using the proper type (there's no way to change type, as far as I can tell). Then, go to (1);
  3. If none of these options work for you, try to add the field as a dimension in the table. This way it will be displayed in the table (I don't know if this bothers you), but this way it doesn't matter if the sort field is a field or metric (green or blue) because it will be treated as a dimension in the table.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...