Forum Discussion

ToffeeMark's avatar
ToffeeMark
Frequent Visitor
6 years ago
Solved

Sales Growth SAMEPERIODLASTYEAR Help

Hi,   I'm fairly new to Power BI, I've gone through the Microsoft Power BI training videos but lack experience so I hope someone could help with my question.   I've made two measures that work to...
  • v-juanli-msft's avatar
    6 years ago

    Hi ToffeeMark 

    Create measures

    sales current = SUM(Sheet2[sales])
    
    max date = CALCULATE(MAX(Sheet2[date]),ALLSELECTED(Sheet2))
    
    end of the month = EOMONTH([max date],0)
    
    ytd current = TOTALYTD([sales current],'calendar'[Date])
    
    ytd current 2 = CALCULATE([ytd current],FILTER('calendar','calendar'[Date]<=[end of the month]))

     

    ytd last year 1 = CALCULATE([ytd current 2],SAMEPERIODLASTYEAR('calendar'[Date]))
    
    ytd last year 2 = IF(MONTH(MAX('calendar'[Date]))<=MONTH([max date]),[ytd last year 1])
    
    ytd last year 3 = MAXX(FILTER('calendar','calendar'[month]<=MONTH([max date])),[ytd last year 2])

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.