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
MoCPA
New Member

Return/generate value based on date range

Hello Community, 

 

I need to right a measure that generate value based on date range. So basically i've calendar table and data input table. 

 

Data Input

Start DateEnd DateAmount
1/1/202012/31/2021100

 

So the requirement is to put this on line chart that has periods from calendar table on x axes and we want a line shows the amount the Amount on every month within that period. 

 

Any ideas other that building a table to spread the amounts of rows? 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @MoCPA ,

 

I suggest you to inactive or remove the relationship between the input table and calendar table. Then create a measure to filter your visual.

Filter = 
VAR _START =
    SELECTEDVALUE ( 'Data Input'[Start Date] )
VAR _END =
    SELECTEDVALUE ( 'Data Input'[End Date] )
RETURN
    IF (
        MIN ( 'Calendar'[Date] ) >= _START
            && MAX ( 'Calendar'[Date] ) <= _END,
        1,
        0
    )

Add this measure into visual level filter and set it to show items when value = 1. Result is a below.

RicoZhou_0-1674200029560.png

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

 

I suggest you to inactive or remove the relationship between the input table and calendar table. Then create a measure to filter your visual.

Filter = 
VAR _START =
    SELECTEDVALUE ( 'Data Input'[Start Date] )
VAR _END =
    SELECTEDVALUE ( 'Data Input'[End Date] )
RETURN
    IF (
        MIN ( 'Calendar'[Date] ) >= _START
            && MAX ( 'Calendar'[Date] ) <= _END,
        1,
        0
    )

Add this measure into visual level filter and set it to show items when value = 1. Result is a below.

RicoZhou_0-1674200029560.png

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.

 

 

amitchandak
Super User
Super User

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.