March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have a field called ReceiptDate and i want to find the numerical difference between that date and one selected by a slicer.
I've managed to capture my selection on the slicer by using SELECTEDVALUE() but can't seem to figure out the measure to get the difference when the results are displayed in a table.
Any ideas?
Ben
EDIT:
Resolved with the following:
MaxMeasure = (MAX('Point in Time Data'[Age From Date])-[SelectedPointInTime])*1
Solved! Go to Solution.
Hi,
Try this measure
=MAX([Age From Date])-[SelectedPointInTime]
Hope this helps.
Hi @Anonymous ,
You can try this measure.
DATEDIFF =
var SelectedDate = SELECTEDVALUE(SlicerTable[SelectedDate])
var CurrentDate = SELECTEDVALUE(Table1[ReceiptDate])
return
DATEDIFF(CurrentDate, SelectedDate, DAY)
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-xicai ,
Thanks for looking at this for me.
That didn't work unfortunately. I'm not selecting the receipt date, it's just a field in my table that i want to compare with my selected date
I've attached a picture to hopefully demonstrate what i'm trying to accomplish
Hi,
Try this measure
=MAX([Age From Date])-[SelectedPointInTime]
Hope this helps.
This does give me an age but i need it calcualte for each date in my table, not just the highest date.
Thanks
Ben
Hi,
My formula should work for each data in the Table.
And so it does! It returned the result as a date which caused me confusion initially, after changing it back to a number I get the right result! Below is the measure I used:
MaxMeasure = (MAX('Point in Time Data'[Age From Date])-[SelectedPointInTime])*1
You are welcome.
Hi @Anonymous ,
Can't it meet your demand using DATEDIFF([Age from date], [SelectedPointInTime], DAY) directly? When you select a date in slicer, it will return the result in the second table visual of your screenshot. Or could you please show your desired output in sample data screenshot for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.
Best Regards,
Amy
Hi @v-xicai ,
I've applied filters to my report, and i'm trying to make the age value in table on the left equal the age in the table on the right. I've uploaded a copy of the .pbix file here
DATEDIFF I requires a single value in order to calculate. DATEDIFF([Age from date], [SelectedPointInTime], DAY) as a measure doesn't work, as I believe some kind of filter is required on [Age from date].
I've tried doing DATEDIFF([Age from date], [SelectedPointInTime], DAY) as a calculated column, and while my measure [SelectedPointInTime] is capturing my selection the calculated column doesn't recalculate so it defaults to the current month...
Thanks for your help
Ben
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
88 | |
88 | |
72 | |
50 |
User | Count |
---|---|
208 | |
159 | |
95 | |
83 | |
70 |