Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
The Below works, however the YTD figure looks at the min date in the whole date column and I have to filer the visual to 2022 year, so I'm wondering if I can amend the dax, so it looks for min date in current year.
Currently using this:
View By Last X Days =
VAR
_7days = ADDCOLUMNS(
CALCULATETABLE(
'Shared Dates'
,DATESBETWEEN('Shared Dates'[Date],today()-7,today() )
)
,"In the last", "7 Days"
)
VAR
_ytd = ADDCOLUMNS(
CALCULATETABLE(
'Shared Dates'
,DATESBETWEEN('Shared Dates'[Date],min('Shared Dates'[Date]),today() )
)
,"In the last", "YTD"
)
return
UNION(_7days,_ytd)
Solved! Go to Solution.
You could use
View By Last X Days =
VAR
_7days = ADDCOLUMNS(
CALCULATETABLE(
'Shared Dates'
,DATESBETWEEN('Shared Dates'[Date],today()-7,today() )
)
,"In the last", "7 Days"
)
VAR
_ytd = ADDCOLUMNS(
CALCULATETABLE(
'Shared Dates'
,DATESBETWEEN('Shared Dates'[Date], DATE( YEAR(TODAY()), 1, 1),today() )
)
,"In the last", "YTD"
)
return
UNION(_7days,_ytd)
You could use
View By Last X Days =
VAR
_7days = ADDCOLUMNS(
CALCULATETABLE(
'Shared Dates'
,DATESBETWEEN('Shared Dates'[Date],today()-7,today() )
)
,"In the last", "7 Days"
)
VAR
_ytd = ADDCOLUMNS(
CALCULATETABLE(
'Shared Dates'
,DATESBETWEEN('Shared Dates'[Date], DATE( YEAR(TODAY()), 1, 1),today() )
)
,"In the last", "YTD"
)
return
UNION(_7days,_ytd)
This worked perfectly. Thanks 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
67 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |