簡體   English   中英

計算Tableau中兩個日期的兩個百分比之間的百分比差異

[英]Calculate the percent difference between two percentages at two dates in Tableau

目標是創建一個列,顯示百分比之間的百分比差異。

嘗試創建許多計算字段

-first() - last() - 這只是計算周數差異

-if date =#2019-02-03#then sum number of records else null end - invalid

-case when date =#2019-02-03#then sum number of records else null end - invalid

“過濾器1”列是我要顯示此信息的位置。

預期結果:過濾器1中的第1行應= 12%(-5和7的絕對百分比變化)

在此輸入圖像描述

任何幫助都非常感謝!

我用兩種方式解決了這個問題:一個創建了兩個日期字段 - 一個用於一周,一個用於最后一周:然后進行差異測量,並將它們用作列。

還有另一種方式,更粗糙:

if first() == 0 then
(
window_sum((if last() == 0 then sum(count_measure) end))
-(window_sum(if first()==0 then sum(count_measure) end))
)
/(window_sum(if first()==0 then sum(count_measure) end))
end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM