Forum Discussion
Help needed graphing a count between a date range
parry2k, thank you very much for that; it makes way more sense now.
However, in the example, only one date field is used; the 'warranty date', but in my source data there are two date fields that impact the result; the start date and the end date; I don't see how to ensure the count on the [Calendar] date takes into concideration both the warranty start and end dates. Can you help me understand this bit please?
yes warranty date is calculated from date range from your sample.
so raw data is exactly the way your table is, serial number, start date, end date
and then it unpivot to get warrantly applicabale for each serial for each date, and count that.
to see all this, go to query editor, and check the steps of "Table1", the first step is exactly the way the data your provided, and next steps do the transforamtion.
- parry2k8 years agoSuper User
I hope you have the solution what you are looking for, that's what all matter :)
- parry2k8 years agoSuper User
That is surely a concern, will slow down the solution, not ideal in that case. Interesting. let's c what else we can do here.
- parry2k8 years agoSuper User
how granular you want to see this warranty? Month Level/Quarter level/Year level.
Current solution will get you to day level
- JLaine8 years agoHelper I
parry2k, at this point in time, I'm thinking that monthly granularity will probably be sufficient. But if you are thinking of a chard by month, with count, know that I also need to seperate by product, and there are several thousand different [products] in the data set, which adds another level of complicaiton I did not want to start this thread with (I'll be grouping those into product families and sub-families, to reduce the number of unique items to filter and chart)
- v-huizhn-msft8 years agoMicrosoft Employee
Hi JLaine,
Have you resolved your issue? If you have, welcome to share your solution or mark the helpful/useful reply as answer. More people will benefit from here. Thanks very much.
Best Regards,
Angelia - JLaine8 years agoHelper I
Not fully, no. This is still an open item.
- dipique8 years agoNew Member
I just wanted to let you know that I have just opened a similar query about the last part of your question: how to expand by month instead of by day. It's located here:
If you've figured out a way to do what you needed without the full expansion, please let me know.
- dipique8 years agoNew Member
I was able to figure this out, details are on this thread.
First, I created a calendar that contains only the first day of each month, and only dates that current or in the past:
Program Active Months = FILTER(CALENDAR(DATE(2018,1,1),DATE(2025,12,31)),AND(DAY([Date])=1, TODAY()>=[Date]))
Then, I used this to produce the table I wanted which showed me enrollee count by client and month:
Active Enrollees = VAR tmpTable = SELECTCOLUMNS( FILTER( GENERATE( Enrollment, 'Program Active Months' ), [Date] >= [Effective_Date__c] && [Date] <= Enrollment[End Date] ), "Id", Enrollment[Id], "Date", [Date], "Account", [Account Name] ) RETURN GROUPBY(tmpTable,[Date],[Account],"Count",COUNTX(CURRENTGROUP(),[Id]))I hope this helps anyone else in a similar situation.