Power BI 中的切片器选择

时间:2021-07-19 08:46:02

标签: powerbi powerbi-desktop nested-if slicers tableau-desktop

我正在尝试将在 Tableau 中完成的以下计算字段复制到 Power BI 中的度量:

来自 Tableau:

IF [Period]=#2018-01-25# THEN
(IF [Parameter Value]='Non-profit' THEN (IF DATEDIFF('month',[pol_date],[Period])<=2 and [non prf tag]='Y' THEN 'New Organisation' ELSE 'Existing Organisation' END)
ELSEIF [Parameter Value]='Profit' THEN (IF DATEDIFF('month',[pol_date],[Period])<=2 and [prf tag]='Y' THEN 'New Organisation' ELSE 'Existing Organisation' END)
ELSEIF [Parameter Value]='Non-prof debt & Prof' THEN (IF [payment_amt]>0 AND DATEDIFF('month',[pol_date],[Period])<=2 THEN 'New Organisation' ELSE 'Existing Organisation' END)
END)
ELSE
(IF [Parameter Value]='Non-profit' THEN (IF [payment_amt]>0 AND [non prf tag]='Y' THEN 'New Organisation' ELSE 'Existing Organisation' END)
ELSEIF [Parameter Value]='Profit' THEN (IF [payment_amt]>0 AND [prf tag]='Y' THEN 'New Organisation' ELSE 'Existing Organisation' END)
ELSEIF [Parameter Value]='Non-prof & Prof' THEN (IF [payment_amt]>0 AND MONTH([startDte])=MONTH([Period]) AND YEAR([startDte])=YEAR([Period]) THEN 'New Organisation' ELSE 'Existing Organisation' END)
END)
END

我如何尝试在 Power BI 中复制它但无济于事:

 Measure = IF(
OR(AND(SELECTEDVALUE('Parameter Table'[Parameter Value]) = "Non-profit", SUMX('Organisation Table', DATEDIFF('Organisation Table'[pol_date] ,'Organisation Table'[Period], MONTH)<=2, 'Organisation Table'[non prf tag] =  "Y" ),'Organisation Table'[Period]="2018-01-25"),

AND(SELECTEDVALUE('Parameter Table'[Parameter Value]) = 'Profit', DATEDIFF('Organisation Table'[pol_date] ,'Organisation Table'[Period], MONTH)<=2,'Organisation Table'[prf tag] =  "Y" ),'Organisation Table'[Period]="2018-01-25"),

AND(SELECTEDVALUE('Parameter Table'[Parameter Value])= 'Non-prof & Prof', DATEDIFFDATEDIFF('Organisation Table'[pol_date] ,'Organisation Table'[Period], MONTH)<=2, 'Organisation Table'[payment_amt]>0, 'Organisation Table'[Period]="2018-01-25"),

AND(SELECTEDVALUE('Parameter Table'[Parameter Value])= 'Non-profit','Organisation Table'[payment_amt]>0,'Organisation Table'[non prf tag]='Y'),

AND(SELECTEDVALUE('Parameter Table'[Parameter Value])= 'Profit','Organisation Table'[payment_amt]>0,'Organisation Table'[prf tag]='Y'),

AND(SELECTEDVALUE('Parameter Table'[Parameter Value])= 'Non-prof & Prof','Organisation Table'[payment_amt]>0,MONTH('Organisation Table'[startDte])=MONTH('Organisation Table'[Period]),YEAR('Organisation Table'[startDte])=YEAR('Organisation Table'[Period]))
),
"New Organisation","Existing Organisation")

在Power Bi方程中,是基于切片器的选择,类似于Tableau的参数选择。有没有好心人知道我该如何解决这个问题?

0 个答案:

没有答案