Forum Discussion

kilala's avatar
kilala
Icon for Resolver I rankResolver I
4 years ago
Solved

Why SPLY doesnt work when I filter?

Hello all,

I wonder why my SPLY doesnt work when user select one month. For example, when user select March, I want to see the actual amount vs last year amount (march). but the value showed is blank. I am so confused.

 

Here is my SPLY measure = 

Amount SPLY =
CALCULATE([Actual Amount, SAMEPERIODLASTYEAR(vw_DimDate[Date]))
 
hope can find a way to solve this. thankssss
  • It's okay all, maybe there is error with my measure. I changed to this and it works:

    Selected Parameter Value Actual SPLY =
    var lastdateAvailable=CALCULATE(MAX(vw_FactSales[Date]),ALL(vw_FactSales)
    var lastyearsameday=lastdateAvailable-365
    var ifLY=IF(DAY(lastyearsameday)<>DAY(lastdateAvailable),TRUE(),FALSE())
    var lastyearsamedayLY=IF(ifLY,lastdateAvailable-366,lastyearsameday)
    var SPLYUntillastdate=FILTER(
    SAMEPERIODLASTYEAR(vw_DimDate[Date].[Date]),
    vw_DimDate[Date].[Date]<=lastyearsamedayLY)
    return
    CALCULATE(
    [Actual Amount],
    SPLYUntillastdate)

2 Replies

  • It's okay all, maybe there is error with my measure. I changed to this and it works:

    Selected Parameter Value Actual SPLY =
    var lastdateAvailable=CALCULATE(MAX(vw_FactSales[Date]),ALL(vw_FactSales)
    var lastyearsameday=lastdateAvailable-365
    var ifLY=IF(DAY(lastyearsameday)<>DAY(lastdateAvailable),TRUE(),FALSE())
    var lastyearsamedayLY=IF(ifLY,lastdateAvailable-366,lastyearsameday)
    var SPLYUntillastdate=FILTER(
    SAMEPERIODLASTYEAR(vw_DimDate[Date].[Date]),
    vw_DimDate[Date].[Date]<=lastyearsamedayLY)
    return
    CALCULATE(
    [Actual Amount],
    SPLYUntillastdate)