DAX Calculated Relationship

2019-08-31 03:30发布

问题:

  • Month, MyMeasure
  • Nov-15, 150
  • Dec-15, 150
  • Jan-16, 200
  • Feb-16, 200 -- projections into the future not desired
  • Mar-16, 200 -- projections into the future not desired
  • Apr-16, 200 -- projections into the future not desired

I have a measure which uses an ALL function to remove the relationship to the date table and calculate a distinctcount in a modified context. Which is great but now the measure extends into the future until the end of the date table.

I need to apply another filter after the first calculation:

If calendar[date] < today() then MyMeasure ELSE blank

or maybe something using LOOKUPVALUE?

回答1:

CALCULATE(
    [<measure>]
    ,FILTER(
        ALL( 'DimDate' )
        ,'DimDate'[Date] <= TODAY()
    )
)