Forum Discussion
Overlapping Dates and Service Type
- Anonymous3 years ago
Hi ConfusedTime ,
You can create a calculated column as below to get it:
Flag = CALCULATE ( DISTINCTCOUNT ( 'Service'[Service] ), FILTER ( 'Service', [ClientID] = EARLIER ( [ClientID] ) && 'Service'[Start Date] > EARLIER ( 'Service'[Start Date] ) && 'Service'[Start Date] <= EARLIER ( 'Service'[End Date] ) && 'Service'[Service] <> EARLIER ( 'Service'[Service] ) ) )Best Regards
Hi,
Sorry for the late reply, it doesn't seem to be working for me, I get a massive long number back?
I've filtered my table to have only 2 service types and put it in your PBI example and get the same result.
I have this working to count overlapping dates (taken from another post) but I need it to only count the overlapping date when the service is different - can I add yours in to this somehow? Sorry I'm not very good with DAX/variables. My table is now filtered to be only 2 different types of services.
Thanks
- Anonymous3 years agoNot applicable
Hi ConfusedTime ,
What's your expected result? Do you want to get the count of IDs or the IDs which fulfill the conditions? Could you please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
- ConfusedTime3 years agoFrequent Visitor
Thanks for your reply. I'm hoping to be able to give a count of overlaps, plus identify who they are so they can be followed up.
I've attached a sample of data, in this example it would highlight 4 overlaps of service (highlighted blue).
Thanks for all your help!
ClientID Service Start Date End Date 11111 Service A 18/11/2018 26/11/2018 11111 Service A 11/05/2019 11111 Service A 19/06/2021 10/07/2021 11131 Service A 27/12/2016 16/06/2017 11131 Service B 13/06/2017 23/09/2017 11131 Service A 24/09/2017 21/07/2018 11131 Service A 22/07/2018 02/10/2018 11131 Service A 14/12/2020 04/01/2021 11131 Service A 03/01/2021 11222 Service A 10/08/2013 24/11/2013 11222 Service A 10/08/2013 06/04/2014 11222 Service A 21/11/2013 06/04/2014 11222 Service B 07/04/2014 17/02/2015 18888 Service A 11/04/2011 09/03/2014 18888 Service A 10/03/2014 17/08/2014 26262 Service A 16/09/2013 11/10/2013 26262 Service B 12/10/2020 20/10/2020 26262 Service A 18/10/2020 01/11/2020 91919 Service A 18/03/2013 02/09/2013 91919 Service A 07/04/2014 12/10/2016 91919 Service B 10/10/2016 99991 Service A 24/10/2019 99991 Service A 07/12/2020 25/06/2021 99991 Service B 25/06/2021 02/07/2021 99991 Service A 03/07/2021 14/09/2021 99991 Service A 26/01/2022 14/09/2022 - Anonymous3 years agoNot applicable
Hi ConfusedTime ,
You can create a calculated column as below to get it:
Flag = CALCULATE ( DISTINCTCOUNT ( 'Service'[Service] ), FILTER ( 'Service', [ClientID] = EARLIER ( [ClientID] ) && 'Service'[Start Date] > EARLIER ( 'Service'[Start Date] ) && 'Service'[Start Date] <= EARLIER ( 'Service'[End Date] ) && 'Service'[Service] <> EARLIER ( 'Service'[Service] ) ) )Best Regards