Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
CJLittle
Frequent Visitor

need help with getting my data visualized properly

Hello all. I have some data that is in a format similar to the following:

 

Ticket NumberOpened DateClosed Date
14/6/20215/2/2021
24/6/20214/7/2021
34/8/20214/15/2021
44/12/20215/7/2021
54/13/20214/18/2021
64/19/20214/22/2021
74/25/20215/10/2021
84/25/20215/1/2021
94/29/20215/1/2021
104/30/20215/3/2021

 

What I need to do is know how many cases were in not closed on a particular date. I can do that by knowing counting the number of rows where the opened date is less than or equal to the particular date and the closed date is greater than the particular date.

 

For example, if I pick 4/10/2021 as the particular date (I also need to be able show this data for all dates, not just dates for which there are Opened and Closed Dates present), I should have a count of two rows (Ticket 1 and Ticket 3). Essentially, I need something that looks similar to the following where could then query on the Date and Open Tickets columns to know how many tickets were open on any particular date:

 

Ticket NumberDateOpened DateClosed DateOpen Tickets
 4/5/2021  0
1 4/6/20215/2/2021 
24/6/20214/6/20214/7/20212
 4/7/2021  1
34/8/20214/8/20214/15/20212
 4/9/2021  2
 4/10/2021  2
 4/11/2021  2
44/12/20214/12/20215/7/20213
54/13/20214/13/20214/18/20214
 4/14/2021  4
 4/15/2021  3
 4/16/2021  3
 4/17/2021  3
 4/18/2021  2
64/19/20214/19/20214/22/20213
 4/20/2021  3
 4/21/2021  3
 4/22/2021  2
 4/23/2021  2
 4/24/2021  2
7 4/25/20215/10/20213
84/25/20214/25/20215/1/20214
 4/26/2021  4
 4/27/2021  4
 4/28/2021  4
94/29/20214/29/20215/1/20215
104/30/20214/30/20215/3/20216
 5/1/2021  4
 5/2/2021  3
 5/3/2021  2

 

I can't seem to wrap my head around how to do this in Power BI though. I've tried a few different measures where I'm calculating the count with a filter but it never gives me anything close to what I would expect. I've gotten closer by creating a date table using the calendar function and then a table visual which looks similar to the following:

 

Ticket NumberDateOpened DateClosed Date
 4/5/2021  
14/6/20214/6/20215/2/2021
24/6/20214/6/20214/7/2021
 4/7/2021  
34/8/20214/8/20214/15/2021
 4/9/2021  
 4/10/2021  
 4/11/2021  
44/12/20214/12/20215/7/2021
54/13/20214/13/20214/18/2021
 4/14/2021  
 4/15/2021  
 4/16/2021  
 4/17/2021  
 4/18/2021  
64/19/20214/19/20214/22/2021
 4/20/2021  
 4/21/2021  
 4/22/2021  
 4/23/2021  
 4/24/2021  
74/25/20214/25/20215/10/2021
84/25/20214/25/20215/1/2021
 4/26/2021  
 4/27/2021  
 4/28/2021  
94/29/20214/29/20215/1/2021
104/30/20214/30/20215/3/2021
 5/1/2021  
 5/2/2021  
 5/3/2021  
 5/4/2021  
 5/5/2021  

 

and while I now have a complete list of dates for the month, I still can't seem filter between the "date" value and the "closed date" value.


Any thoughts on how to pull this off would be greatly appreciated. Thanks.

1 ACCEPTED SOLUTION

thanks for your reply @CJLittle 

sure, try to change 'Table'[Closed Date] >= _seldate to Table'[Closed Date] > _seldate  in measures

count = 
var _seldate=SELECTEDVALUE(calendarTable[Date])
return countrows(filter('Table', 'Table'[Opened Date]<=_seldate &&'Table'[Closed Date]>_seldate))

result

vxiaotang_0-1628820308966.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
CJLittle
Frequent Visitor

This seems like it might be closer to what I want but isn't taking into account the fact that ticket number 3 was closed on 4/15, reducing the total number of tickets open on 4/15 to 3 from 4.

thanks for your reply @CJLittle 

sure, try to change 'Table'[Closed Date] >= _seldate to Table'[Closed Date] > _seldate  in measures

count = 
var _seldate=SELECTEDVALUE(calendarTable[Date])
return countrows(filter('Table', 'Table'[Opened Date]<=_seldate &&'Table'[Closed Date]>_seldate))

result

vxiaotang_0-1628820308966.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much. This got me almost all the way there. I just had to add in an or statement around the closed date to check for null values too. The final measure looks like the following:

 

count = 
var _seldate=SELECTEDVALUE(calendarTable[Date])
return countrows(filter('Table', 'Table'[Opened Date]<=_seldate && ('Table'[Closed Date]>_seldate || 'Table'[Closed Date] = BLANK())))

 

v-xiaotang
Community Support
Community Support

Hi @CJLittle 

Have you solved this question? If yes, could you kindly accept the answer helpful as the solution (or kindly share your solution ). so the others can find it more quickly.

 

Any question, please let me know. Looking forward to receiving your reply.

 

 

Best Regards,

Community Support Team _Tang

v-xiaotang
Community Support
Community Support

Hi @CJLittle

Your solution looks a bit complicated, would you consider trying an alternative? 😜 it will be simpler.

-

try this measure

count = 
var _seldate=SELECTEDVALUE(calendarTable[Date])
return countrows(filter('Table', 'Table'[Opened Date]<=_seldate &&'Table'[Closed Date]>=_seldate))

vxiaotang_0-1628760578325.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.