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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Line chart range function

I currently have a report that pulls together many line items and orgainzes them by department, report date and hours. When transitioning to a new month I would like a function or measure that would search for the most recent date then calculate the first and last day of the month. 

 

Example: Most recent date is 8/3/2022 function sets minimum range to 8/1/2022 seperate function for maximum range would set the range to 8/31/2022. 

 

The reason for this is I would like a seamless transition between months so I do not have to manually change the ranges for every chart in every report.

 

Thanks in advance!

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Anonymous ,

 

Try adding a Relative date filter to the line chart.

vcgaomsft_0-1659936680554.png

It will automatically filter the data for this month based on Today() automatically.

 

Or you want to display all the data, use the auxiliary line to mark the current month's data:

Please new measures:

start of the month = EOMONTH(TODAY(),-1) + 1
end of the month = EOMONTH(TODAY(),0)

Add Lines:

vcgaomsft_1-1659937322350.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

Anonymous
Not applicable

Hi @Anonymous ,

 

Do you want something like this?

vcgaomsft_1-1660095974546.png

If yes, please try measures like:

line_1 = 
CALCULATE (
    [Measure],
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date]
            = EOMONTH ( MAX ( 'Calendar'[Date] ), -1 ) + 1
    )
)
line_2 = 
CALCULATE (
    [Measure],
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date]
            = EOMONTH ( MAX ( 'Calendar'[Date] ), 0 )
    )
)

The PBIX file is attached for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Gao,

This answer gets me close because it will filter the data for the current month. However this does not help me update the range of the line chart. Could this be done through a measure?

Anonymous
Not applicable

Hi @Anonymous ,

 

Do you want something like this?

vcgaomsft_1-1660095974546.png

If yes, please try measures like:

line_1 = 
CALCULATE (
    [Measure],
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date]
            = EOMONTH ( MAX ( 'Calendar'[Date] ), -1 ) + 1
    )
)
line_2 = 
CALCULATE (
    [Measure],
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date]
            = EOMONTH ( MAX ( 'Calendar'[Date] ), 0 )
    )
)

The PBIX file is attached for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Anonymous
Not applicable

Hi @Anonymous ,

 

Try adding a Relative date filter to the line chart.

vcgaomsft_0-1659936680554.png

It will automatically filter the data for this month based on Today() automatically.

 

Or you want to display all the data, use the auxiliary line to mark the current month's data:

Please new measures:

start of the month = EOMONTH(TODAY(),-1) + 1
end of the month = EOMONTH(TODAY(),0)

Add Lines:

vcgaomsft_1-1659937322350.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.