Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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.
User | Count |
---|---|
18 | |
18 | |
14 | |
13 | |
13 |
User | Count |
---|---|
17 | |
14 | |
14 | |
10 | |
8 |