Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.
Hi,
I would like to create a scenario where a user chooses a date which is then used to calculate the number of days,weeks and months between the user's chosen date and dates in a table column which are shown in a report.
The parameter should have a default value of today's date.
Would you be able to advise me of the easiest way to do this ?
Many thanks
Scott
Solved! Go to Solution.
Hello @PaisleyPrince,
Can you please try creating a date parameter and use it to dynamically calculate the difference:
Days Difference =
VAR ChosenDate = SELECTEDVALUE('Selected Date'[Date], TODAY())
RETURN
DATEDIFF(ChosenDate, MIN('YourTable'[DateColumn]), DAY)
Weeks Difference =
VAR ChosenDate = SELECTEDVALUE('Selected Date'[Date], TODAY())
RETURN
DATEDIFF(ChosenDate, MIN('YourTable'[DateColumn]), WEEK)
Months Difference =
VAR ChosenDate = SELECTEDVALUE('Selected Date'[Date], TODAY())
RETURN
DATEDIFF(ChosenDate, MIN('YourTable'[DateColumn]), MONTH)
Hope this helps.
Hello @PaisleyPrince,
Can you please try creating a date parameter and use it to dynamically calculate the difference:
Days Difference =
VAR ChosenDate = SELECTEDVALUE('Selected Date'[Date], TODAY())
RETURN
DATEDIFF(ChosenDate, MIN('YourTable'[DateColumn]), DAY)
Weeks Difference =
VAR ChosenDate = SELECTEDVALUE('Selected Date'[Date], TODAY())
RETURN
DATEDIFF(ChosenDate, MIN('YourTable'[DateColumn]), WEEK)
Months Difference =
VAR ChosenDate = SELECTEDVALUE('Selected Date'[Date], TODAY())
RETURN
DATEDIFF(ChosenDate, MIN('YourTable'[DateColumn]), MONTH)
Hope this helps.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
19 | |
13 | |
10 | |
9 | |
9 |