Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Aggregation for Same Period Last Year-

Hi Everyone,

 

I have an aggregate measure accumulating the sales as the months go on called "Actual TRG AGG"

 

 

I've highlighted above the portion relating to the Aggregating element but when I try to create the same measure for the year before:

 

You can see that I'm not able to maintain the aggregating element.. how do I keep the aggregation in the -1 measure?

 

Thanks,

Eyal

 

 

 

  • Anonymous , In the that max filter for cumulative you should use date table

     

    filter(allselected('Date'),'Date'[date] <=max('Date'[date])

     

     

    and for one year use the same calculation with

    var _max = max('Date'[date])

    var _date = date(year(_max), month(_max), day(_max) )

    return

    calculate([Actual TRG], filter(allselected('Date'),'Date'[date] <=_date ) , <Rest of the calc> )

     

     

4 Replies

  • Anonymous , In the that max filter for cumulative you should use date table

     

    filter(allselected('Date'),'Date'[date] <=max('Date'[date])

     

     

    and for one year use the same calculation with

    var _max = max('Date'[date])

    var _date = date(year(_max), month(_max), day(_max) )

    return

    calculate([Actual TRG], filter(allselected('Date'),'Date'[date] <=_date ) , <Rest of the calc> )

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    These are my filters in case I wasn't clear amitchandak . And yes I switch from sales dates to calendar dates table. 

     

     

     

    Thanks amitchandak and tried it --> see '-1v2' below:

    It gives the same as the original year. I need it to add(aggregate) so for February it would be the sum of the highlighted (371+408=779)

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Ok I found it based on your solution amitchandak and here it is!

     

     

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    amitchandak is there a way to make this instead of sameperiodlastyear, to have it reference to last month?