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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
zacharydailey
Regular Visitor

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
v-cgao-msft
Community Support
Community Support

Hi @zacharydailey ,

 

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

Hi @zacharydailey ,

 

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
zacharydailey
Regular Visitor

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?

Hi @zacharydailey ,

 

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

v-cgao-msft
Community Support
Community Support

Hi @zacharydailey ,

 

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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