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
qLollo
Frequent Visitor

Measure which uses a dynamic date in the calculate

Hi All,

 

Sadly here once again.

I have to create a measure which, given a date by the user, checks if it is between two dates, and counts how many times it happens.
Herewith my thought process:
X = Date given by the user

Measure = CALCULATE(COUNTROWS('Table'), X >= 'Table'[First Date] && X <= 'Table'[Second Date])

 

Now, my problem is when i have to do - X = Date given by the user - since i have no idea how it could be done. Is there any way i can give the measure a parameter which is given by the user?
So something like, i put something in the report where the user can type, make a measure which takes that value and in my measure above i replace X with this new measure.

 

Thanks,

L

1 ACCEPTED SOLUTION
PC2790
Community Champion
Community Champion

Try:

 

Measure = 
var DateSelected = SelectedValue(Table[Date])

return

CALCULATE(COUNTROWS('Table'), Filter(DateSelected >= 'Table'[First Date] && DateSelected <= 'Table'[Second Date]))

View solution in original post

3 REPLIES 3
PC2790
Community Champion
Community Champion

Hey @qLollo ,

 

You can provide a slicer with all the permissible dates you want user to select.

And when the user selects the date, you can capture that information using

DateSelected = Selectedvalue(Table[Date])

Further you can use it in your calculation.

qLollo
Frequent Visitor

Hi @PC2790, thanks for replying.

What you suggested to get the selected date works fine.
The problem now is that when i replace the X with the measure [DateSelected] i get an error.

Which is: In a True/False expression, used as a table filter, a function 'PLACEHOLDER' has been used, this is not allowed
The measure now is

Measure = CALCULATE(COUNTROWS('Table'), [DateSelected] >= 'Table'[First Date] && [DateSelected] <= 'Table'[Second Date])
 
PC2790
Community Champion
Community Champion

Try:

 

Measure = 
var DateSelected = SelectedValue(Table[Date])

return

CALCULATE(COUNTROWS('Table'), Filter(DateSelected >= 'Table'[First Date] && DateSelected <= 'Table'[Second Date]))

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