Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |