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 Experts
Need a calcuated column measure which returns a value of 1 if the date falls with the YTD parameter and all future dates as 2. I have a date column in my FACT Table.
Solved! Go to Solution.
Hi, @Anonymous
In amitchandak's formula, you need to replace 'and' with '&&'.
The formula should be something like as below:
a new column =
VAR _max =
TODAY ()
VAR _min =
DATE ( YEAR ( _max ), 1, 1 )
RETURN
SWITCH ( TRUE (), [Date] > _max, 2, [Date] <= _max && [Date] >= _min, 1, 0 )
Best Regards,
Community Support Team _ Eason
@Anonymous ,
a new column =
var _max = today()
var _min = date(year(_max),1,1)
return
Switch(True(),
[Date] >_max, 2,
[Date] <=_max and [Date] >=_min , 1,
0)
Hi Amit - Getting and error on this line of DAX "var _min = date(year(_max),1,1)"
Hi, @Anonymous
In amitchandak's formula, you need to replace 'and' with '&&'.
The formula should be something like as below:
a new column =
VAR _max =
TODAY ()
VAR _min =
DATE ( YEAR ( _max ), 1, 1 )
RETURN
SWITCH ( TRUE (), [Date] > _max, 2, [Date] <= _max && [Date] >= _min, 1, 0 )
Best Regards,
Community Support Team _ Eason
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 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |