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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
SMITHY10283
Regular Visitor

Dynamically update chart based on data available

I have a bar chart in power bi that shows me data from January 2022 to June 2023. The X-axis shows Month/Year, so essentially monthly values from Jan 2022 to June 2023. I want to ensure that based on the date of the latest available data, for example in this case June 2023, I want the chart to dynamically show the previous 12 months. So for example as soon as July data is populated in data model, I want the chart to dynamically update and show the data from July 2022 to July 2023. 

I've been trying to add in measures to filter lane in power bi but to no avail. 

If any other information is needed let me know 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @SMITHY10283 ,

 

You can create a measure and add this measure into visual level filter.

Flag =
VAR _RANGESTART =
    EOMONTH ( TODAY (), -13 ) + 1
VAR _RANGEEND =
    EOMONTH ( TODAY (), 0 )
RETURN
    IF (
        MAX ( 'TableName'[Date] ) >= _RANGESTART
            && MAX ( 'TableName'[Date] ) <= _RANGEEND,
        1,
        0
    )

Add this measure into the visual level filter and set it to show items when value =1.

 

Best Regards,
Rico Zhou

 

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 @SMITHY10283 ,

 

You can create a measure and add this measure into visual level filter.

Flag =
VAR _RANGESTART =
    EOMONTH ( TODAY (), -13 ) + 1
VAR _RANGEEND =
    EOMONTH ( TODAY (), 0 )
RETURN
    IF (
        MAX ( 'TableName'[Date] ) >= _RANGESTART
            && MAX ( 'TableName'[Date] ) <= _RANGEEND,
        1,
        0
    )

Add this measure into the visual level filter and set it to show items when value =1.

 

Best Regards,
Rico Zhou

 

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

 

lbendlin
Super User
Super User

You can use a calculated column. It will be calculated every time the dataset refreshes.  Set it to 1 if the date is within the last 12 months, and to 0 if not.  Use that calculated column as a filter for the visual, the page, or the entire report.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.