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 want to see the previous month date against the existing date column in my dataset.
For e.g. If column DOJ shows the date 15/09/22, the measure should show 15/08/22.
We can achieve this output in Calculated Column by writing following DAX
=Dateadd(DOJ,-1,MONTH)
However I am not sure how can we achieve the same result by writing a measure.
Solved! Go to Solution.
Hi @vishu263 ,
If you really wanna use a measure, you can try this one:
DateMeasure = VAR _year = YEAR ( SELECTEDVALUE ( TablePivot[Date] ) ) VAR _month = MONTH ( SELECTEDVALUE ( TablePivot[Date] ) ) VAR _day = DAY ( SELECTEDVALUE ( TablePivot[Date] ) ) RETURN IFERROR ( DATE ( _year, _month - 1, _day), EOMONTH ( DATE ( _year, _month, 1 ), 0 ) )
Does this work?
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Hi @vishu263 ,
If you really wanna use a measure, you can try this one:
DateMeasure = VAR _year = YEAR ( SELECTEDVALUE ( TablePivot[Date] ) ) VAR _month = MONTH ( SELECTEDVALUE ( TablePivot[Date] ) ) VAR _day = DAY ( SELECTEDVALUE ( TablePivot[Date] ) ) RETURN IFERROR ( DATE ( _year, _month - 1, _day), EOMONTH ( DATE ( _year, _month, 1 ), 0 ) )
Does this work?
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Yes, It does. Thanks a lot for quick solution 🙂
Hi @vishu263 ,
My tip here is to use a date dimension and precalculate this "samedaypreviousmonth" attribute already in the dimension instead of creating a separate measure.
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
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 |
---|---|
43 | |
23 | |
21 | |
15 | |
15 |
User | Count |
---|---|
46 | |
31 | |
30 | |
18 | |
18 |