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.
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
Solved! Go to Solution.
Try:
Measure =
var DateSelected = SelectedValue(Table[Date])
return
CALCULATE(COUNTROWS('Table'), Filter(DateSelected >= 'Table'[First Date] && DateSelected <= 'Table'[Second Date]))
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.
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
Try:
Measure =
var DateSelected = SelectedValue(Table[Date])
return
CALCULATE(COUNTROWS('Table'), Filter(DateSelected >= 'Table'[First Date] && DateSelected <= 'Table'[Second Date]))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |