Forum Discussion
Dynamic Month Numbering based on different start date for each product
Hi All,
We are trying to compare sales on Product across Months in the same chart.
Is it possible to do this dynamically in Power BI based on what products are selected in a slicer?
For Example, If Product A started on January 2017 then that would be considered Month 1 for Product A.
While Product B start on July 2019 then that would be considered Month 1 for Product B.
Chart would look like below:
Hi, acbg
I create a sample. You need to create a calculated column.
Like this:
MONTHCOLUMN = VAR a = RANKX ( FILTER ( Table1, [product] = EARLIER ( Table1[product] ) ), YEAR ( Table1[DATE] ) * 100 + MONTH ( Table1[DATE] ), , ASC, DENSE ) RETURN "month" & aBest Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- v-janeyg-msft
Community Support
Hi, acbg
I create a sample. You need to create a calculated column.
Like this:
MONTHCOLUMN = VAR a = RANKX ( FILTER ( Table1, [product] = EARLIER ( Table1[product] ) ), YEAR ( Table1[DATE] ) * 100 + MONTH ( Table1[DATE] ), , ASC, DENSE ) RETURN "month" & aBest Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- parry2k
Super User
acbg yes for this kind of cohort analysis, you need to create a table that will contain, product, date, and calculated month number based on the product start date, and then it is going to be straightforward. A lot of heavy lifting will be done on data modelling and this calculated table.
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡