gpt4 book ai didi

How to create measure in Power BI following condition on Fact and Dim(在Fact和Dim的条件下如何在Power BI中创建度量)

转载 作者:bug小助手 更新时间:2023-10-22 15:15:43 30 4
gpt4 key购买 nike



I have 1 Fact and 2 Dim and how can I create measure on condition

我有1个事实和2个维度,以及如何在条件下创建度量值



  1. DIM_DATE.U_DATE > Todaydate ==> 0

  2. DIM_TRAN.EXPIRY_DATE <= Todaydate ==> FACT_TRAN.Value
    3.(else) DIM_DATE.U_DATE <= Todaydate && DIM_TRAN.Expiry_date > Todaydate
    == > Datediff(DIM_DATE.U_DATE,DIM_TRAN.EXPIRY_DATE) * FACT_TRAN.Value/Datediff(DIM_DATE.U_DATE,DIM_TRAN.EXPIRY_DATE)


enter image description here

在此处输入图像描述


file to download .pbix ==> https://easyupload.io/rr3b0w

要下载的文件.ppix==>https://easyupload.io/rr3b0w


I try to use switch
Like this : Test M = SWITCH(TRUE(),
SELECTEDVALUE(DIM_DATE[U_DATE]) > TODAY(),0,1)
but value is multiple.

我试着这样使用开关:测试M=switch(TRUE(),SELECTEDVALUE(DIM_DATE[U_DATE])>TODAY(),0,1),但值是倍数。


enter image description here

在此处输入图像描述


更多回答

easyupload.io/rr3b0w file to download .PBIX

easyupload.io/rr3b0w文件可下载。PBIX

优秀答案推荐

Hi i have used IF dax function and selectedvalue dax function to buld the dax query. Logic is a bit unclear to me, but I have created the logic as you intended.

嗨,我使用了IF dax函数和selectedvalue dax函数来构建dax查询。逻辑对我来说有点不清楚,但我已经按照你的意图创建了逻辑。


_calmeasure = 
VAR todaydate =
TODAY ()
VAR udate =
SELECTEDVALUE ( DIM_DATE[U_DATE] )
VAR expiry =
SELECTEDVALUE ( DIM_TRAN[EXPIRY_DATE] )
VAR cond =
IF (
udate > todaydate,
0,
IF (
expiry <= todaydate,
CALCULATE ( MAX ( FACT_TRAN[Value] ) ),
IF (
udate <= todaydate
&& expiry > todaydate,
DATEDIFF ( udate, expiry, DAY ) * SELECTEDVALUE ( FACT_TRAN[Value] )
/ DATEDIFF ( udate, expiry, DAY ),
0
)
)
)
RETURN
cond

更多回答

Thank you very much it help me to solve it

非常感谢它帮我解决了这个问题

Please upvote and accept my answer

请投赞成票并接受我的回答

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com