Forum Discussion
Top 3 Consecutive Selling Months DAX Help
- 7 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
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
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-msft7 years agoMicrosoft 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
- IamTDR7 years agoResponsive Resident
Thanks again for the help. I tried adding this measure to my report and only received blank results. I downloaded your example and added the measure to your report and it worked. Played around with it a bit and I now believe the issue is that with my actual data I have loads of different ISBNs not just one. When I added additional ISBNs to the sample data in your report, the measure proceeded to no longer work.
In the meantime I am trying to do the calculation now via SQL and then import the results via a table. Maybe my best case workaround.
- v-danhe-msft7 years agoMicrosoft Employee
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