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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors