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.
Hello community,
I am trying to find a way how to get the list of date when i do this expression with DAX :
For exemple : 16/11/2025 - 3
The output should be like this (the last 3 Dates):
16/11/2024
16/11/2023
16/11/2022
Solved! Go to Solution.
Hi @DYY94 ,
Please try below steps:
1. below is my test table
create with dax formula
Table = CALENDAR(DATE(2022,1,1),DATE(2025,12,31))
2. create a measure with below dax formula and add a card visual with this measure
Measure =
VAR str = "2025/11/16-3"
VAR _date =
FORMAT ( LEFT ( str, 10 ), "yyyy/mm/dd" )
VAR _num =
RIGHT ( str, 1 )
VAR _cal =
MID ( str, 11, 1 )
VAR tmp =
FILTER (
ALL ( 'Table' ),
YEAR ( [Date] )
>= YEAR ( _date ) - _num
&& YEAR ( [Date] ) < YEAR ( _date )
&& MONTH ( [Date] ) = MONTH ( _date )
&& DAY ( [Date] ) = DAY ( _date )
)
VAR _a =
CONCATENATEX ( tmp, [Date], "
" )
RETURN
SWITCH ( TRUE (), _cal = "-", _a )
Please refer the attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @DYY94 ,
Please try below steps:
1. below is my test table
create with dax formula
Table = CALENDAR(DATE(2022,1,1),DATE(2025,12,31))
2. create a measure with below dax formula and add a card visual with this measure
Measure =
VAR str = "2025/11/16-3"
VAR _date =
FORMAT ( LEFT ( str, 10 ), "yyyy/mm/dd" )
VAR _num =
RIGHT ( str, 1 )
VAR _cal =
MID ( str, 11, 1 )
VAR tmp =
FILTER (
ALL ( 'Table' ),
YEAR ( [Date] )
>= YEAR ( _date ) - _num
&& YEAR ( [Date] ) < YEAR ( _date )
&& MONTH ( [Date] ) = MONTH ( _date )
&& DAY ( [Date] ) = DAY ( _date )
)
VAR _a =
CONCATENATEX ( tmp, [Date], "
" )
RETURN
SWITCH ( TRUE (), _cal = "-", _a )
Please refer the attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @v-binbinyu-msft it's great !
Is it possible to duplicate rows by Code_ISIN for each dates ?
- Each date in a row with the same Code_ISIN.
Check below screenshot.
Thank a lot !
Hi @v-binbinyu-msft ,
Thanks for the solution it's really hepful as i need it.
I need just some edit about the Output if it possible.
1- for exemple when i do this :
and also for this condition:
-And is it possible to store the dates in a list or table because i'm gonna use it later in other formula.
You can check below screenshot inluding the the input column and you the output with your solution.
Thanks again for you help 🙂
It sounds like you want to copare specifik dates from diffrent years.
If this is the case then this is the way I would do it.
Add a calender table.
connect it to the table you want to filter on.
add the dates in the x-axis
Legend should be years.
This way you will be able to see result from the diffrent years right next to each other.
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 |
---|---|
110 | |
101 | |
76 | |
64 | |
63 |
User | Count |
---|---|
141 | |
104 | |
101 | |
80 | |
67 |