简体   繁体   中英

Tableau - multiple records that meet IF condition

I would like to multiple values that meet criteria in tableau.

For example:

if [order status] = cancelled and [dtime] = express then 39 
else other end (so it counts number of records *39) 

What I need is to not count the number of records but all unique order_id 's so I used:

if [order status] = cancelled and [dtime] = express then (countd[order id] * 39)

but this does not work.

scenario: COUNTD(If

[Expedition Type] = "ZEX" and [count bigboxy aj smallboxy] = "BIGBOX" and [Transporter] = "Mall Box" then [Order Id] * 260.6

 ELSEIF  ([Expedition Type] = "ZEX" and [count bigboxy aj smallboxy] = "BIGBOX" and [Transporter]= "Mall Pick-Up") then [Order Id] * 260.7
 ELSEIF  ([Expedition Type] = "ZEX" and [count bigboxy aj smallboxy] = "BIGBOX" and [Transporter] = "Ulozenka") then  [Order Id] * 260.6
 ELSEIF  ([Expedition Type] = "ZEX" and [count bigboxy aj smallboxy] = "BIGBOX" and [Transporter] = "--empty--" or [Transporter] = "Cash and Carry" or [Transporter] = "Česká pošta"
  or [Transporter] = "DPD" or [Transporter] = "Helicar" or [Transporter] = "Mall doprava" or [Transporter] = "PPL CZ" or [Transporter] = "Speedy Kuryr" or [Transporter] = "TopTrans CZ" or [Transporter] = "WE|DO" 
  or [Transporter] = "Gebrüder Weiss") then [Order Id] * 260.6 END)

在此处输入图像描述

COUNTD(if [order status] = cancelled and [dtime] = express then [order id] END) * 39

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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