Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
SparkDataGuru
Frequent Visitor

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' to filter the 'Month Year' to a 'relative date is this month'. This works fine for all days until Jan 1, 2023...

 

Filter Date - Relative Date - This Month.png

 

How can I ensure that the report will show Dec 1 to 31, 2022 when the calendar date is Jan 1, 2023? 

 

Thank you for your help!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @SparkDataGuru ,

I created some data:

vyangliumsft_0-1671588192473.png

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.

vyangliumsft_1-1671588192474.png

3. Result:

vyangliumsft_2-1671588192479.png

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @SparkDataGuru ,

I created some data:

vyangliumsft_0-1671588192473.png

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.

vyangliumsft_1-1671588192474.png

3. Result:

vyangliumsft_2-1671588192479.png

 

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

themistoklis
Community Champion
Community Champion

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.