Forum Discussion

SparkDataGuru's avatar
SparkDataGuru
Frequent Visitor
3 years ago
Solved

Relative Dates For Automated Reporting

I have a report which has data uploaded daily up to month to date prior (for example: if today is Dec 20, 2022, I have data from Dec 1 to 19, 2022). Currently we are utilizing 'Filters on all pages' ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  SparkDataGuru ,

    I created some data:

    Here are the steps you can follow:

    1. Create measure.

    Flag =
    var _today=TODAY()
    return
    SWITCH(
        TRUE(),
        _today=DATE(YEAR(_today),MONTH(_today),1)&&
        MAX('Table'[Date]) >=DATE(YEAR(_today),MONTH(_today)-1,DAY(_today))&&
        MAX('Table'[Date]) <_today,1,
         _today<>DATE(YEAR(_today),MONTH(_today),1)&&
        MAX('Table'[Date]) >=DATE(YEAR(_today),MONTH(_today),1)&&MAX('Table'[Date])<_today,1,0)

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly