Forum Discussion
Filtering open tickets based on date
- 4 years ago
Hi Anonymous ,
Please try the following measures:
MTicketsIn = CALCULATE ( COUNTROWS ( TestData ), FILTER ( TestData, ( TestData[Opened_Date] < MIN ( TestDates[Date] ) && ISBLANK ( TestData[Closed_Date] ) || ( TestData[Opened_Date] < MIN ( TestDates[Date] ) && TestData[Closed_Date] >= MIN ( TestDates[Date] ) ) ) ) )MTicketsOut = CALCULATE ( COUNTROWS ( TestData ), FILTER ( TestData, ( TestData[Opened_Date] <= MAX ( TestDates[Date] ) && ISBLANK ( TestData[Closed_Date] ) || ( TestData[Opened_Date] <= MAX ( TestDates[Date] ) && TestData[Closed_Date] > MAX ( TestDates[Date] ) ) ) ) )MCurrentTickets = CALCULATE ( COUNTROWS ( TestData ), FILTER ( TestData, ( TestData[Opened_Date] <= MIN ( TestDates[Date] ) && ISBLANK ( TestData[Closed_Date] ) || ( TestData[Opened_Date] <= MIN ( TestDates[Date] ) && TestData[Closed_Date] >= MAX ( TestDates[Date] ) ) ) ) )MClosedTickets = CALCULATE ( COUNTROWS ( TestData ), FILTER ( TestData, ( TestData[Closed_Date] >= MIN ( TestDates[Date] ) && TestData[Closed_Date] <= MAX ( TestDates[Date] ) ) ) )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Please try the following measures:
MTicketsIn =
CALCULATE (
COUNTROWS ( TestData ),
FILTER (
TestData,
(
TestData[Opened_Date] < MIN ( TestDates[Date] )
&& ISBLANK ( TestData[Closed_Date] )
|| (
TestData[Opened_Date] < MIN ( TestDates[Date] )
&& TestData[Closed_Date] >= MIN ( TestDates[Date] )
)
)
)
)MTicketsOut =
CALCULATE (
COUNTROWS ( TestData ),
FILTER (
TestData,
(
TestData[Opened_Date] <= MAX ( TestDates[Date] )
&& ISBLANK ( TestData[Closed_Date] )
|| (
TestData[Opened_Date] <= MAX ( TestDates[Date] )
&& TestData[Closed_Date] > MAX ( TestDates[Date] )
)
)
)
)MCurrentTickets =
CALCULATE (
COUNTROWS ( TestData ),
FILTER (
TestData,
(
TestData[Opened_Date] <= MIN ( TestDates[Date] )
&& ISBLANK ( TestData[Closed_Date] )
|| (
TestData[Opened_Date] <= MIN ( TestDates[Date] )
&& TestData[Closed_Date] >= MAX ( TestDates[Date] )
)
)
)
)MClosedTickets =
CALCULATE (
COUNTROWS ( TestData ),
FILTER (
TestData,
(
TestData[Closed_Date] >= MIN ( TestDates[Date] )
&& TestData[Closed_Date] <= MAX ( TestDates[Date] )
)
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
They all work Great, Thank you so much!
So my sample MticketsIn above was pretty close . I was using TestDates[Date].[Date} instead of just TestDates[Date]
What does TestDates[Date].[Date] represent?
- Anonymous4 years agoNot applicable
Hi Again!
Just looking at this again the currentTickets looks fine on the day view but on the month view it shows only one ticket was active during the month. I would have thought it would show that it would show All 7 as active for september because all the tickets were opened in that month so (incase anyone looks back at this) i modified the MCurrentTickets to be
MCurrentTickets =CALCULATE (COUNTROWS ( TestData ),FILTER (TestData,(//If it was open before this period and never closedTestData[Opened_Date] <= MIN ( TestDates[Date] )&& ISBLANK ( TestData[Closed_Date] )||//If it was opened or closed in this period(TestData[Opened_Date] <= MIN ( TestDates[Date] )||TestData[Opened_Date] <= MAX( TestDates[Date] )))))So your tickets in plus opened tickets in a period - current tickets (any ticket active in the period) minus Closed tickets = =tickets out.aka.BegininningBalance+additions=current/activeand current -closed =endingbalance- Anonymous4 years agoNot applicable
Doh,
Having just reread mthat i realize its not right, sorry.
- Anonymous4 years agoNot applicableMCurrentTickets =CALCULATE (COUNTROWS ( TestData ),FILTER (TestData,(//If it was open before this period and never closedTestData[Opened_Date] <= MIN ( TestDates[Date] )&& ISBLANK ( TestData[Closed_Date] )||//If it was opened in this period(TestData[Opened_Date] >= MIN ( TestDates[Date] ) && TestData[Opened_Date] <= MAX ( TestDates[Date] ) )||//If it was closed in this period(TestData[Closed_Date] >= MIN ( TestDates[Date] ) && TestData[Closed_Date] <= MAX ( TestDates[Date] ) ))))works :