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.
I have a table with the following example data:
NATURE | DATE1 |
NOTEBOOK | 2016.01.01 |
I would like to add a column, which is generated based on these:
If the NATURE column has "NOTEBOOK" in it, add X years to DATE1 column.
X value is depended on a slicer value which you can choose in the visualization.
I was trying to do this with several methods, but nothing seems to work.
Can you help?
Thanks.
Solved! Go to Solution.
Hi @gebhaarde
try this, create the measure
date2 =
var _addY=SELECTEDVALUE(Slicer[Rollout years])
var _year=EDATE(MIN('Table'[date1]),_addY*12)
return _year
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
@gebhaarde , You need to create create a measure
datediff(max(Table[Date1]) ,maxx(allselected(date),date[date]), day)
In case you want to add or avg
you need
sumx(values(Table[NATURE]), datediff(max(Table[Date1]) ,maxx(allselected(date),date[date]), day) )
@amitchandak Unfortunately, this isn't working.
Maybe I wasn't clear, let me reelaborate, this is my data source:
inventory number | nature | date1 | date2 |
a1 | NOTEBOOK | 2016.01.01. | |
a2 | MOBILE | 2017.02.01 | |
a3 | NOTEBOOK | 2019.05.01. |
I would like to calculate a column "date2" (or a measure if its better) that adds X years to "date1" column.
The value X is chosen with a slicer like this:
So if I set 3 years in the slicer, the first row's date2 column would be 2019.01.01, but if I set 3.5 or 4 years, the date2 column would update accordingly.
My final goal is to count these values by inventory numbers in a matrix visualsation according to date2.
Thanks in advance!
Hi @gebhaarde
try this, create the measure
date2 =
var _addY=SELECTEDVALUE(Slicer[Rollout years])
var _year=EDATE(MIN('Table'[date1]),_addY*12)
return _year
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |