Forum Discussion
Top 3 Consecutive Selling Months DAX Help
- 8 years ago
Hi IamTDR,
Based on my test, it could work on my side, could you please offer me your data file and also you could download my sample pbix to have a view.
Regards,
Daniel He
Share some sample data and expected result in excel format
| ISBN | Month | Quantity_Sold | Consecutive_Selling_Months |
| 1571 | 9/1/2018 | 7,521 | 12,620 |
| 1571 | 8/1/2018 | 3,575 | 11,634 |
| 1571 | 7/1/2018 | 1,524 | 12,934 |
| 1571 | 6/1/2018 | 6,535 | 20,985 |
| 1571 | 5/1/2018 | 4,875 | 21,908 |
| 1571 | 4/1/2018 | 9,575 | 21,598 |
| 1571 | 3/1/2018 | 7,458 | 21,571 |
| 1571 | 2/1/2018 | 4,565 | 15,687 |
| 1571 | 1/1/2018 | 9,548 | 14,700 |
| 1571 | 12/1/2017 | 1,574 | 11,700 |
| 1571 | 11/1/2017 | 3,578 | 10,126 |
| 1571 | 10/1/2017 | 6,548 | 6,548 |
So in this sample data this product's top consecutive month is 21,908. So I need that qty amount to later computer than if my inventory falls below 21,908 I will need to flag it to be re-ordered.
- v-danhe-msft8 years ago
Microsoft Employee
Hi IamTDR,
Based on my test, you could refer to below steps:
Create a calender table and create the relationship:
Table = CALENDARAUTO()
Create measure:
Measure = CALCULATE(SUM(Table1[Quantity_Sold]),DATESINPERIOD('Table'[Date],MAX('Table'[Date]),-3,MONTH))Result:
You could also download the pbix file to have a view.
Regards,
Daniel He
- IamTDR8 years ago
Responsive Resident
Thanks for the reply and suggestion. Yet I am still trying to find a way to just show the top 3 consecutive months of sales. The method you provided I came up with something similar. Is there a way to just just the one top consecutive month? So from your example, it would only show 21,908?
Overall I am trying to find a method to show top 3 consecutive months of sales for a bunch of different products. Once I have that information I want to use those numbers as a basis to calculate re-order stock point.
- v-danhe-msft8 years ago
Microsoft Employee
Hi IamTDR,
Based on my test, you could create a new formula:
Max Value = IF([Measure]=MAXX(ALL('Table1'),'Table1'[Measure]),[Measure],BLANK())Result:
Regards,
Daniel He