cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
acbg
Resolver III
Resolver III

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:

acbg_0-1624308777248.png

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
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" & a

vjaneygmsft_0-1624518256324.png

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-janeyg-msft
Community Support
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" & a

vjaneygmsft_0-1624518256324.png

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

parry2k
Super User III
Super User III

@acbg well yes that can be done, it is all going to come down to DAX and disconnected tables but very much possible.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





@parry2k Thank you for the confirmation. Would you be able to advise how I can achieve this via dax? which dax statement I would use? 

parry2k
Super User III
Super User III

@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.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





@parry2k  Thank you! Is there a way to do this more dynamically via Dax? As this was just an example. I have a lot more complex where they want the start dates to be dynamic based on different slicers. Hence the months will change based on different slicers selected.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors