Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

sameperiodTHISyear Time Filtering

The Why: So I am building out a visualization that leverages time as a filter/slicer to pick between two points in time. From that filtering/slicer of time I'm looking to see a like for like comparis...
  • v-frfei-msft's avatar
    7 years ago

    Hi Anonymous,

     

    I made one sample for your reference.

     

    1. Create a CALENDAR table and create relationship with the fact table as below.

     

     

    2. Create the measures as below.

     

    Current Year's "burn rate" = var mind =CALCULATE(MIN('CALENDAR'[Date]))
    var maxd = CALCULATE(MAX('CALENDAR'[Date]))
    var thisyearmin = DATE(YEAR(TODAY()),MONTH(mind),DAY(mind))
    var thisyearmax = DATE(YEAR(TODAY()),MONTH(maxd),DAY(maxd))
    return
    CALCULATE(SUM(Table1[burn rate]),FILTER(Table1,Table1[date]>=thisyearmin && Table1[date]<=thisyearmax))
    Selected Period's "burn rate" = CALCULATE(SUM(Table1[burn rate]),USERELATIONSHIP('CALENDAR'[Date],Table1[date]))

     

    For more details, please check the pbix as attached.

     

    Regards,

    Frank

  • v-frfei-msft's avatar
    v-frfei-msft
    7 years ago

    Hi Anonymous,

     

    Does that make sense? If so, kindly mark my answer as a solution to close the case.


    Regards,
    Frank

  • Anonymous's avatar
    Anonymous
    7 years ago

    Hey, I really appreciate your help on this, this response got kicked by my spam filter for whatever the reason! 

     

    Nevertheless, thank you so much! Happy Holidays!