DAX公式以多个条件获取最新日期。

huangapple go评论63阅读模式
英文:

DAX formula to get the latest date based on multiple criteria

问题

我有这个在Power BI中用于度量的DAX公式,我需要返回最新的日期,如果它与表单名称匹配并且已经完成,即等于1(已完成字段要么是1,要么是0)。

我有以下公式,但它没有返回我想要的结果。即使[Finalized]为零,它仍然返回日期。我错在哪里?

Observed_Date = 
    CALCULATE (
        MAX ( 'Form Results'[DateObserved] ),
        'Form Results'[Formname] = "Office Worker" 
            && MAX('Form Results'[Finalized]) = 1
    )
英文:

I have this DAX formula for a Measure in PBI, I need to return the latest date if it matches the form name AND if it is Finalized i.e. equals 1 (the Finalized field is either 1 or 0).

I have the formula as below, however, it's not returning the result I want. It's still returning the date even when [Finalized] is zero. Where I got it wrong?

Observed_Date = 
    CALCULATE (
        MAX ( 'Form Results'[DateObserved] ),
        'Form Results'[Formname] = "Office Worker" 
            && max('Form Results'[Finalized])=1
    )

答案1

得分: 2

在你的 DAX 公式中移除对 'Form Results'[Finalized]MAX 函数:

Observed_Date = CALCULATE ( MAX ( 'Form Results'[DateObserved] ), 'Form Results'[Formname] = "Office Worker" && 'Form Results'[Finalized] = 1 )
英文:

Remove max for 'Form Results'[Finalized]) in your dax formula

Observed_Date = CALCULATE ( MAX ( 'Form Results'[DateObserved] ), 'Form Results'[Formname] = "Office Worker" && 'Form Results'[Finalized])=1 

huangapple
  • 本文由 发表于 2023年6月16日 09:40:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76486480.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定