Forum Discussion

Richsellars's avatar
Richsellars
New Member
7 years ago

Dynamic date measure

Hi All,

Ive come up with a scenario I can’t work the solution out for.

Essentially on a report slicer, I want to select a custom set of dates. What I want to see is on a report table is a list of items and total sales volume against them based on the slicer.

I can get a simple measure to work for the dates in question, however I can’t seem to find out how to build a measure to show the sales in the previous week and also the sales in the previous year as per the custom date filter.

I have got it working for whole weeks, but the problem is the data required is more specific than that.

Any thoughts greatly appreciated.

Thanks

Rich

3 Replies

  • Hi,

     

    See if this works for sales in previous year (for chosen slicer dates)

     

    =CALCULATE([your measure],SAMEPERIODLASTYEAR(Calendar[Date]))

     

    There should be a relationship from the Date column of your Sales Table to the Date column of your Calendar Table.

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi Richsellars,








    By my test, the measure from Ashish_Mathur should help you get the sales in the previous year.

     

    In addition, if you want to calcualte the sales in the previous week, you could try this measure below.

     

    Measure = CALCULATE(SUM('Table'[Sales]),DATEADD('Table'[Date],-7,DAY))

    If you still need help, please share some data sample and your desired output so that we could help further on it.

     

    Best  Regards,

    Cherry

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi Richsellars,

     

    Have you solved your problem?

     

    If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

     

    If you still need help, please feel free to ask.

     

    Best  Regards,

    Cherry