Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I am using a DAX function as below but this is not retuning correct value as even though an agent is in 2/3 chats at the same time (before the end of earlier chat), the measure only shows as 1. How to fix?
You can create a calculated column with this DAX
Count of Concurrent Chat =
COUNTROWS (
FILTER (
'Table',
(
'Table'[Chat Initiated On] < EARLIER ( 'Table'[Chat Initiated On] )
&& 'Table'[Chat Terminated On] > EARLIER ( 'Table'[Chat Initiated On] )
)
|| (
EARLIER ( 'Table'[Chat Terminated On] ) > 'Table'[Chat Initiated On]
&& 'Table'[Chat Initiated On] > EARLIER ( 'Table'[Chat Initiated On] )
)
)
) + 1
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hello,
I am afraid it doesnt work, can you please check once and guide.
Also, please bear in mind that the objective is, we find that on any particular interval, was the agent was (Assigned agent) in 1, 2 or 3 chat as a concurrency
Can you please provide some dummy data to show the table you have? Is [Assigned Agent] column located in the same table as the [Chat initiated on] & [Terminated on] columns? In addition, please provide the expected output based on the dummy data as well as the logic to get there.
As of now I guess that you want to use a slicer to switch the Assigned Agent and show the count of concurrent chats for every chat period of that person. Assume all data is from the same table, I add a new column to that table with below code. Then in the table visual, select Sum instead of Count for the [Count of Concurrent Chat] column.
Count of Concurrent Chat =
COUNTROWS (
FILTER (
'Table',
'Table'[Assigned Agent] = EARLIER ( 'Table'[Assigned Agent] )
&& (
(
'Table'[Chat Initiated On] < EARLIER ( 'Table'[Chat Initiated On] )
&& 'Table'[Chat Terminated On] > EARLIER ( 'Table'[Chat Initiated On] )
)
|| (
EARLIER ( 'Table'[Chat Terminated On] ) > 'Table'[Chat Initiated On]
&& 'Table'[Chat Initiated On] > EARLIER ( 'Table'[Chat Initiated On] )
)
)
)
) + 1
Download the attached pbix to see if it can meet your need. If it's still not what you want, I may have misunderstood your requirement. Please provide dummy data I required in the first paragraph above to help me understand your objective clearly.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Thanks, the solution looks better now but still not completely fixed as if an agent has taken a chat late at night and it extends to the following day, the current code takes it as earlier and gives wrong value.. Can you check , attached is a screenshot.
There is no way I can actually add the PBIX file that I have so that you could see, but if you could let me know a way, I am happy to share..
For now attached image
You can refer to this blog about the several methods of providing sample data https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
From the screenshot I cannot get where it is wrong. When you share some dummy data, can you provide the correct result along with it? In this way, I can compare my output with the correct result to varify it's correct or wrong. Take care that you should remove sensitive data like email account, names, addresses from the sample data before sharing. You can mock up some dummy data.
Best Regards,
Community Support Team _ Jing
Thank you so much for looking into it and sharing this excellent tip, I was not aware.
Kindly find the table and I shall await your feedback
| Assigned Agent | Agent Connected On | Terminated On |
| gupta.sumit-s@xyz.com | 7/18/2022 11:54:10 PM | 7/19/2022 12:19:01 AM |
| gupta.sumit-s@xyz.com | 7/18/2022 11:47:29 PM | 7/19/2022 12:12:15 AM |
| gupta.sumit-s@xyz.com | 7/18/2022 11:47:27 PM | 7/19/2022 12:31:23 AM |
| pradeepkumar.pandey@xyz.com | 7/18/2022 11:45:22 PM | 7/19/2022 12:24:02 AM |
| areli.faz-sanchez@xyz.com | 7/18/2022 11:24:41 PM | 7/18/2022 11:52:25 PM |
| pradeepkumar.pandey@xyz.com | 7/18/2022 11:20:55 PM | 7/18/2022 11:52:36 PM |
| pradeepkumar.pandey@xyz.com | 7/18/2022 11:16:07 PM | 7/18/2022 11:45:08 PM |
| pradeepkumar.pandey@xyz.com | 7/18/2022 11:11:27 PM | 7/18/2022 11:47:56 PM |
| aditya.tiwari@xyz.com | 7/18/2022 11:07:59 PM | 7/18/2022 11:30:00 PM |
| aditya.tiwari@xyz.com | 7/18/2022 11:02:07 PM | 7/18/2022 11:29:54 PM |
| -- | -- | 7/18/2022 11:29:54 PM |
| areli.faz-sanchez@xyz.com | 7/18/2022 10:53:14 PM | 7/18/2022 11:03:28 PM |
| piyush.gade@xyz.com | 7/18/2022 10:47:21 PM | 7/18/2022 10:52:50 PM |
| krishna.vitekar@xyz.com | 7/18/2022 10:46:37 PM | 7/18/2022 11:34:26 PM |
| krishna.vitekar@xyz.com | 7/18/2022 10:41:54 PM | 7/18/2022 11:10:33 PM |
| pradeepkumar.pandey@xyz.com | 7/18/2022 10:29:30 PM | 7/18/2022 10:49:46 PM |
| pradeepkumar.pandey@xyz.com | 7/18/2022 10:27:24 PM | 7/18/2022 10:45:28 PM |
| gupta.sumit-s@xyz.com | 7/18/2022 10:20:56 PM | 7/18/2022 11:13:04 PM |
| pradeepkumar.pandey@xyz.com | 7/18/2022 10:13:40 PM | 7/18/2022 10:45:19 PM |
| aditya.tiwari@xyz.com | 7/18/2022 10:13:46 PM | 7/18/2022 10:37:01 PM |
| gupta.sumit-s@xyz.com | 7/18/2022 10:13:07 PM | 7/18/2022 10:59:19 PM |
| sergio.jimenez-gaspar@xyz.com | 7/18/2022 9:55:25 PM | 7/18/2022 10:25:25 PM |
| pradeepkumar.pandey@xyz.com | 7/18/2022 9:50:35 PM | 7/18/2022 10:22:45 PM |
| aditya.tiwari@xyz.com | 7/18/2022 9:37:50 PM | 7/18/2022 10:27:25 PM |
| gupta.sumit-s@xyz.com | 7/18/2022 9:36:25 PM | 7/18/2022 10:05:06 PM |
Thank you for the sample data. I have applied it to the report. Let me know where you think the concurrent count is wrong. To me I think it is correct.
Best Regards,
Jing
Dear Jing,
Firstly, I really appreciate your help but it seems I am just getting crazy with this one..
I am using the same code as is with update on the table as mine is named as 'data' but the results I guess is wrong, attach screenshot where you can see it comes as 22,23 etc
I am doing everything exactly as it's in your PBIX but I cant get through. So I searched again..
I realised that the Agent connected on and Terminated On in my table is in a text format while in yours is date format, do you think - that could be the issue? If yes, how do I fix? As When I try to duplicate the tables and convert to table its gives error "Cannot parse...."
Your help will be appreciated
Yes, it is probably the cause. Both the Agent connected on and Terminated On columns should be in Datetime data type. If it's in Text data type, the comparison with ">" and "<" operators will not work correctly to compare datetime values.
You can change the data type at two places, one is in Power BI Desktop as below.
The other is in Power Query Editor as below. Then click Close&Apply or Apply to apply this change to Power BI Desktop.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Yeah, I am aware of these two but as already mentioned, it wont allow me change the format from text to date/time and gives error. see attached
The sad part is, the database from where I am getting this data is coming in text format only.
Any other trick or solution you know, that could fix this?
Hi @Abhishek8895 Can you modify the data type in Power Query Editor? What will happen there?
Same thing, cannot parse..see attached
Reason is that this dataset is completely crazy, there is a "--" value in Agent terminated on date and that's why it doesnt allow to parse. Even I tried to due it DAX using datevalue..
Anything you could suggest?
Oh I see. You need to clean data before changing the data type. What does "--" represent in the data table? If it represents blank datetime on that row, you can replace it with empty in the column. After changing its data type to datetime, it will display null without any error. Note that null datetime is a very small datetime in Power BI. If your "--" has other meanings, you need to replace it with another valid acceptable datetime value.
If "--" is meaningless in your data and you want to get rid of rows with "--", you can filter out rows that have "--".
After cleaning the data, you can change the data type correctly.
Jing
If its ok with you, can we connect over call on teams or goggle meet and check this together..
My email is abhisheka013@gmail.com
Sorry I cannot provide support outside of community. You can create a support ticket at https://powerbi.microsoft.com/support/ . It is free if you have a Pro license. The escalation engineer will contact you quickly via Email or Call to help solve it.
Best Regards,
Community Support Team _ Jing
No it doesnt fix as gets the same parse error message.
If the email that is presented in the screenshot is confidential, can you kindly remove it from the screenshot so it is not visible.
Thank you in advance!
Theo
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Sorry, I did not understand what solution you are referring me to accept, as I didnt see anything..
Can you or anyone help please
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.