Forum Discussion

kylee_anne's avatar
kylee_anne
Helper II
1 year ago
Solved

Calculate using date filter

Hi,

 

I'm trying to this:

But I can't and don't understand why.

 

I'm trying to sum to a certain reporting date which changes and so can't be hard coded.

This is the DAX I have for it:

So what am I missing?  All help appreciated.

  • Hi kylee_anne 

     

    Try this,

     

    Calculate( Sum ( Sales), Filter ( 'Table', 'Table'[Date]= Max( 'Table'[Date]))

     

    I hope I answered your question!

     

     

2 Replies

  • Uzi2019's avatar
    Uzi2019
    Community Champion

    Hi kylee_anne 

     

    Try this,

     

    Calculate( Sum ( Sales), Filter ( 'Table', 'Table'[Date]= Max( 'Table'[Date]))

     

    I hope I answered your question!

     

     

  • hi kylee_anne ,
     
    It is not allowed to reference a measure in a predicate filter argument - a simple equation. We need to write in its complete form with FILTER. 
     
    try like:
    Earned =
    CALCULATE(
        SUM(data[hours]),
        FILTER(
            data, 
            data[date] = [Reporting Period]
        )
    )