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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
h11
Helper III
Helper III

Dynamic measure with selected date range

Hi everyone,

 

I have data represented in a line and clustered column chart that shows the capacity of each user. The X-axis displays the ppl names, and the Y-axis shows the number of projects assigned. We have a target of 10 projects per month per person.

 

I need to create a dynamic measure or a calculated column on the line Y-axis to reflect this target. For example, if the date range is set to one month (October 1 to October 31), the target should be 10. If the date range is 2 months (October 1 to November 30), the target should be 20 (10 projects per month), and so on for up to six months.

 

Currently, I have a static measure to show the target line on the chart, but I need a dynamic line that adjusts its values based on the selected date range.

 

Here is the screenshot for your reference.

 

h11_0-1727977756462.png

 

Here is the data:

 

Project TitleNameDate
1Bhaskar29-Nov-24
2 Vicky 20-Dec-24
3Bhaskar20-Dec-24
4Bhaskar20-Dec-24
5 David 31-Oct-24
6 Anil31-Oct-24
7Steve31-Oct-24
8Bhaskar31-Oct-24
9Bhaskar31-Oct-24
10Taylor31-Oct-24
11 Anil31-Oct-24
12 Anil31-Oct-24
13 Anil1-Nov-24
14 Anil1-Dec-24
15Steve1-Nov-24
16Bhaskar1-Dec-24
17Bhaskar11-Oct-24
18Bhaskar11-Oct-24
19Bhaskar1-Nov-24
20 Anil1-Dec-24
21 Anil11-Oct-24
22 Anil11-Oct-24
23 Anil1-Nov-24
24Steve1-Dec-24
25Steve11-Oct-24
26Steve11-Oct-24
27Steve11-Oct-24
28Steve11-Oct-24
29Steve15-Nov-24
30 David 15-Nov-24
31 David 15-Nov-24
32 David 2-Dec-24
33 David 2-Dec-24
34 David 2-Dec-24
35 David 31-Oct-24
36 David 31-Oct-24
37 David 31-Oct-24
38 David 15-Nov-24
39 Vicky 15-Nov-24
40 Vicky 15-Nov-24
41 Vicky 31-Oct-24
42 Vicky 31-Oct-24

 

I request to attach the Power BI file that you worked on using my data as a reference. Thank you in advance. 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@h11 you can check number of months selected and then multiple by 10

 

Target = 
VAR __FixedValue = 10
VAR __MinDate = MIN ( 'Calendar'[Date] )
VAR __MaxDate = MAX ( 'Calendar'[Date] )
VAR __MonthsSelected = DATEDIFF ( __MinDate, __MaxDate, MONTH ) + 1
RETURN
__FixedValue * __MonthsSelected


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
h11
Helper III
Helper III

Got the solution. Thank you so much! 

parry2k
Super User
Super User

@h11 you can check number of months selected and then multiple by 10

 

Target = 
VAR __FixedValue = 10
VAR __MinDate = MIN ( 'Calendar'[Date] )
VAR __MaxDate = MAX ( 'Calendar'[Date] )
VAR __MonthsSelected = DATEDIFF ( __MinDate, __MaxDate, MONTH ) + 1
RETURN
__FixedValue * __MonthsSelected


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi,

 

Thank you so much for providing a solution to my question. It solved 80% of my problem. However, the measure that you shared currently only adds the target if there are projects in that month. I need to add an equal target for everyone. For example, the target should be 10 for the first month, 20 for the second month, and 30 for the third month, creating a straight line for everyone. Could you please help me create a measure to achieve this?

 

Please look at the below screenshot for reference:

 

h11_0-1728569578400.png

 

The target of taylor is only 10 since he has only a project in the month of Oct. But ideally he should have the same target as 30 if I choose the filter from Oct to Dec. 

 

I hope you understood my request. Please help me. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors