The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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 |
---|---|
14 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
28 | |
19 | |
13 | |
8 | |
5 |