Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have two columns. One column with "Purchase date" & Second column with "Subscription Type" which looks like this:
Purchase Date | Subscription Type |
09/01/2023 | Yearly |
15/01/2023 | Monthly |
02/02/2023 | Yearly |
25/03/2023 | Monthly |
The Output I am expecting for instance for first 2 rows needs to be this (For Yearly, 08/01/2024) & (For Monthly, 15/02/2023).
I want to add a custom column for calculating expiration date based on this two columns, which functions can I use to set it? or If someone can write a function for this particular case, it would be really greatful.
Solved! Go to Solution.
Hi again @mosarahit48 🙂
update your formula to :
Date.AddDays( if [Subscription Type] = "Yearly" then Date.AddYears([Purchase Date],1)
else
Date.AddMonths([Purchase Date],1),-1)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @mosarahit48
You can add custom column with formula:
=if [Subscription Type] = "Yearly" then Date.AddYears([Purchase Date],1)
else
Date.AddMonths([Purchase Date],1)
Result :
Sample file
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Ritaf1983 Thank you for presenting the solution. I greatly appreciate that.
However, I would like to see the expiration date as 1 day before, for instance: "for Yearly: "09/01/2023" to "08/01/2024" & "for Monthly: "28/02/2023" to "27/03/2023".
Could you further assist me with this.
Hi again @mosarahit48 🙂
update your formula to :
Date.AddDays( if [Subscription Type] = "Yearly" then Date.AddYears([Purchase Date],1)
else
Date.AddMonths([Purchase Date],1),-1)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
65 | |
63 | |
52 | |
37 | |
36 |
User | Count |
---|---|
82 | |
67 | |
61 | |
46 | |
45 |