Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
Kindly advise, I have a column with dates and I want to get the exact 6 months from the Original dates to a precision of even a day which will be less than one day from original in order to get exact 6 months. Many Thanks.
Original Date | |Last 6 Months from Original Date column |
30/12/2021 | 29/06/2021 |
20/12/2021 | 19/06/2021 |
Solved! Go to Solution.
Hi @PowerBIData ,
Try this:
Use M:
Date.AddDays(Date.AddMonths([#"Original Date "], -6),-1)
Use DAX:
Column = EDATE([Original Date ],-6)-1
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @PowerBIData ,
Try this:
Use M:
Date.AddDays(Date.AddMonths([#"Original Date "], -6),-1)
Use DAX:
Column = EDATE([Original Date ],-6)-1
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @PowerBIData ,
In Power Query M it would be something like this:
Date.AddMonths([Original Date], -6)
In DAX it would be something like this:
DATEADD(yourTable[Original Date], -6, MONTH)
However, I'm unsure about your definition of "exactly 6 months". The closest you would probably get would be to apply a day adjustment, rather than a month adjustment.
Power Query M:
Date.AddDays([Original Date], -182) //This or -183 are as close to half a year as you'll get
DAX:
DATEADD(yourTable[Orginal Date], -182, DAY)
Pete
Proud to be a Datanaut!
User | Count |
---|---|
91 | |
73 | |
68 | |
63 | |
55 |
User | Count |
---|---|
96 | |
89 | |
73 | |
61 | |
58 |