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
Ray_Brosius
Helper III
Helper III

Building a visual to track Ticket status and Cost

I've asked this question before but have not found a suitable solution, so giving the community forum another crack at this. 

 

At the bottom of this post, I have provided a very simple example table which contains the "data".    The data is a very basic snapshot table which contains a row for each ticket for each day.

 

I have  provided a screenshot of  the "example" output I am looking for.

 

Basically in a report a user would dynamically select the Date Range to evaluate..  This typically would be done by providing a slicer on the snapshot date column.  in the screenshot Showing the example with Start = 1/5/2022 and End = 1/9/2022.  They could also filter the report based on the Category or any other Attribute that might be in the data. ( not showing other attributes to keep it simple).

 

We want to show what the Tickets looked like on the first day of the evaluation timeframe the number of tickets per status and the Value $$'s...  then for each Ticket Status show where the tickets ended up. 

  • For the 2 tickets that were in "New" with a value of $4 they ended up with 1  "In Progress" with a value of $1  and 1 "Closed" with a value of  $10.  
  • For the 1 ticket that was "In Progress" at $1  it ended up in "In Progress" with a value of $3

 

 

Ray_Brosius_0-1674741046688.png

 

 

Ticket IDStatusCategoryValueSnapshot Date
1NewHardware$11/1/2022
2NewQuestion$31/1/2022
3NewHardware$11/1/2022
1NewHardware$11/2/2022
2NewQuestion$31/2/2022
3NewHardware$11/2/2022
1NewHardware$11/3/2022
2NewQuestion$31/3/2022
3NewHardware$11/3/2022
1NewHardware$11/4/2022
2NewQuestion$31/4/2022
3NewHardware$11/4/2022
1NewHardware$11/5/2022
2NewQuestion$31/5/2022
3In ProgessHardware$11/5/2022
1NewHardware$11/6/2022
2InProgressQuestion$91/6/2022
3In ProgessHardware$11/6/2022
1InProgressHardware$21/7/2022
2ClosedQuestion$101/7/2022
3In ProgessHardware$11/7/2022
1InProgressHardware$21/8/2022
2ClosedQuestion$101/8/2022
3In ProgessHardware$11/8/2022
1InProgressHardware$31/9/2022
2ClosedQuestion$101/9/2022
3In ProgessHardware$11/9/2022
1InProgressHardware$31/10/2022
2ClosedQuestion$101/10/2022
3ClosedHardware$11/10/2022
1InProgressSoftware$61/11/2022
2ClosedQuestion$101/11/2022
3ClosedHardware$11/11/2022
1TestingSoftware$101/12/2022
2ClosedQuestion$101/12/2022
3ClosedHardware$11/12/2022
1TestingSoftware$101/13/2022
2ClosedQuestion$101/13/2022
3ClosedHardware$11/13/2022
1ClosedSoftware$201/14/2022
2ClosedQuestion$101/14/2022
3ClosedHardware$11/14/2022

 

1 ACCEPTED SOLUTION

I was able to figure out how to calculate the Flow of Tickets based on user selected evaluation dates.. 

I pasted some of the code below an an updated "Visual"  The Visual shows the Ticket count per status at the start and at the end..    Then the "Started In" table shows  "where" the tickets at the end "started in"  So the  In Progress ticket row shows that there were 2 at the end and one came from the new status and one came from the In Progress Status.

 

Ray_Brosius_1-1675261245109.png

 

Created a measure to count the number of Tickets at the Start and At the end filtering by the respective "Evaluation Dates".  #Tickets at Start and #Tickets at End

 

#Tickets at Start =

VAR _EvalStartDate = SELECTEDVALUE( 'Snapshot Start'[Start Date] )

VAR _Tickets =

CALCULATE(

COUNT( 'Tickets'[Ticket ID] ),

FILTER('Tickets','Tickets'[Snapshot Date] = _EvalStartDate)
)

RETURN

if(_Tickets=BLANK(),0,_Tickets)

 

 

#Tickets at End =

VAR _EvalEndDate = SELECTEDVALUE( 'Snapshot End'[End Date])

VAR _Tickets =

CALCULATE(

COUNT( 'Tickets'[Ticket ID] ),

FILTER('Tickets','Tickets'[Snapshot Date] = _EvalEndDate)
)

RETURN

if(_Tickets=BLANK(),0,_Tickets)

 

At_Start_New_Status is a measure that determines if a record was in a specific status at the start. . Showing in the below only the measure for the status of NEW .  Each status would need it's own measure.


At_Start_New_Status =

VAR _Ticket =SELECTEDVALUE( 'Tickets'[Ticket ID] )

VAR _EvalStartDate = SELECTEDVALUE( 'Snapshot Start'[Start Date] )

VAR Result =

IF( COUNTROWS(

FILTER(

FILTER( 

ALL( 'Tickets' ),

_Ticket = 'Tickets'[Ticket ID] && 'Ticket'[Status]="New"

   ),

_EvalStartDate = 'Tickets'[Snapshot Date]

)

    )
> 0,
1,
0
)

RETURN _Result

#Tickets_at_End_Started_in_New is a measure that counts the number of records at the end which were in a the status of "New" at the start evaluation date.

 

#Tickets_at_End_Started_in_New =

VAR _Ticket = SELECTEDVALUE( 'Tickets'[Ticket ID] )
VAR _EvalEndDate = SELECTEDVALUE( 'Snapshot End'[End Date] )

VAR _Result =

CALCULATE(

COUNTROWS(

FILTER( 'Tickets',

'Tickets'[Snapshot Date] = _EvalEndDate &&
[At_Start_New_Status] = 1

    )

)

)

RETURN _Result

 

#New Tickets is a measure to count the tickets that were created after the Start Date.

 

#New Tickets=

VAR _TicketID = SELECTEDVALUE( 'Tickets'[Ticket ID] )
var EvalEndDate = SELECTEDVALUE( 'Snapshot End'[End Date] )
VAR _New =

CALCULATE(

COUNTROWS(
FILTER( 'Tickets',

'Tickets'[Snapshot Date] = EvalEndDate &&
[New Deal] = 1
)
)
)

RETURN  _New 

 

New Ticket  is a measure to determine if a Ticket was created AFTER the Start Date.  To do this created one measure to determine if the ticket was in the start date and one to determine if the ticket was in the end date.  (Record in Start Eval Period, Record in End Eval Period )

 

New Ticket =

var SelectedTicket = SELECTEDVALUE('Tickets'[Ticket ID])
var Result = IF( [Record in Start Eval Period] =0 && [Record in End Eval Period] =1,1,0)
Return Result



Record in Start Eval Period =

VAR SelectedTicket = SELECTEDVALUE('Tickets'[Ticket ID])
var EvalStartDate = SELECTEDVALUE( 'Snapshot Start'[Start Date] )
var Result =

IF(
COUNTROWS(

FILTER(

FILTER(ALL('Tickets'),

SelectedTicket = 'Tickets'[Ticket ID]
),

EvalStartDate = 'Tickest'[Snapshot Date]

)

)>0,1,0

)

Return Result

 

Record in End Eval Period =

VAR SelectedTicket = SELECTEDVALUE('Tickets'[Ticket ID])
var EvalEndDate = SELECTEDVALUE( 'Snapshot End'[End Date] )
var Result =

IF(

COUNTROWS(

FILTER(

FILTER(ALL('Tickets'),

SelectedTicket = 'Tickets'[Ticket ID]

),

EvalEndDate = 'Tickest'[Snapshot Date]
)

)>0,1,0

)

Return Result

 

 

View solution in original post

7 REPLIES 7
Ray_Brosius
Helper III
Helper III

I wonder if I Phrase the issue differently, will it help to articluate the challenge I am trying to solve.

1) We have data in a "snapshot" type model  1 row per ticket per day showing the values for each ticket on each day

2) We want to create a report where the user can select two snapshot dates to Evaluate. Start Date and End Date

3) We want to show the movement of tickets between the Start Date and the End Date for each Ticket Status.

 

It is "easy" to count the number of tickets in each status at the start.. and then the number of tickets in each status at the end.  But we want to show for each Status at the start where the tickets, in that status, ended up at the end.

 

This requires a dynamic filtering of the Fact table by the Start Date and Status then Joining that list of Ticket IDs to a dynamically filterd version of the Fact table by the End Date and then counting the Tickets in the end status.. 

 

ON the surface this does not seem like a UNIQUE or CUSTOM solution to develop.  We are basically trying to track the "FLOW" of Tickets through a defined workflow.   

 

I was able to figure out how to calculate the Flow of Tickets based on user selected evaluation dates.. 

I pasted some of the code below an an updated "Visual"  The Visual shows the Ticket count per status at the start and at the end..    Then the "Started In" table shows  "where" the tickets at the end "started in"  So the  In Progress ticket row shows that there were 2 at the end and one came from the new status and one came from the In Progress Status.

 

Ray_Brosius_1-1675261245109.png

 

Created a measure to count the number of Tickets at the Start and At the end filtering by the respective "Evaluation Dates".  #Tickets at Start and #Tickets at End

 

#Tickets at Start =

VAR _EvalStartDate = SELECTEDVALUE( 'Snapshot Start'[Start Date] )

VAR _Tickets =

CALCULATE(

COUNT( 'Tickets'[Ticket ID] ),

FILTER('Tickets','Tickets'[Snapshot Date] = _EvalStartDate)
)

RETURN

if(_Tickets=BLANK(),0,_Tickets)

 

 

#Tickets at End =

VAR _EvalEndDate = SELECTEDVALUE( 'Snapshot End'[End Date])

VAR _Tickets =

CALCULATE(

COUNT( 'Tickets'[Ticket ID] ),

FILTER('Tickets','Tickets'[Snapshot Date] = _EvalEndDate)
)

RETURN

if(_Tickets=BLANK(),0,_Tickets)

 

At_Start_New_Status is a measure that determines if a record was in a specific status at the start. . Showing in the below only the measure for the status of NEW .  Each status would need it's own measure.


At_Start_New_Status =

VAR _Ticket =SELECTEDVALUE( 'Tickets'[Ticket ID] )

VAR _EvalStartDate = SELECTEDVALUE( 'Snapshot Start'[Start Date] )

VAR Result =

IF( COUNTROWS(

FILTER(

FILTER( 

ALL( 'Tickets' ),

_Ticket = 'Tickets'[Ticket ID] && 'Ticket'[Status]="New"

   ),

_EvalStartDate = 'Tickets'[Snapshot Date]

)

    )
> 0,
1,
0
)

RETURN _Result

#Tickets_at_End_Started_in_New is a measure that counts the number of records at the end which were in a the status of "New" at the start evaluation date.

 

#Tickets_at_End_Started_in_New =

VAR _Ticket = SELECTEDVALUE( 'Tickets'[Ticket ID] )
VAR _EvalEndDate = SELECTEDVALUE( 'Snapshot End'[End Date] )

VAR _Result =

CALCULATE(

COUNTROWS(

FILTER( 'Tickets',

'Tickets'[Snapshot Date] = _EvalEndDate &&
[At_Start_New_Status] = 1

    )

)

)

RETURN _Result

 

#New Tickets is a measure to count the tickets that were created after the Start Date.

 

#New Tickets=

VAR _TicketID = SELECTEDVALUE( 'Tickets'[Ticket ID] )
var EvalEndDate = SELECTEDVALUE( 'Snapshot End'[End Date] )
VAR _New =

CALCULATE(

COUNTROWS(
FILTER( 'Tickets',

'Tickets'[Snapshot Date] = EvalEndDate &&
[New Deal] = 1
)
)
)

RETURN  _New 

 

New Ticket  is a measure to determine if a Ticket was created AFTER the Start Date.  To do this created one measure to determine if the ticket was in the start date and one to determine if the ticket was in the end date.  (Record in Start Eval Period, Record in End Eval Period )

 

New Ticket =

var SelectedTicket = SELECTEDVALUE('Tickets'[Ticket ID])
var Result = IF( [Record in Start Eval Period] =0 && [Record in End Eval Period] =1,1,0)
Return Result



Record in Start Eval Period =

VAR SelectedTicket = SELECTEDVALUE('Tickets'[Ticket ID])
var EvalStartDate = SELECTEDVALUE( 'Snapshot Start'[Start Date] )
var Result =

IF(
COUNTROWS(

FILTER(

FILTER(ALL('Tickets'),

SelectedTicket = 'Tickets'[Ticket ID]
),

EvalStartDate = 'Tickest'[Snapshot Date]

)

)>0,1,0

)

Return Result

 

Record in End Eval Period =

VAR SelectedTicket = SELECTEDVALUE('Tickets'[Ticket ID])
var EvalEndDate = SELECTEDVALUE( 'Snapshot End'[End Date] )
var Result =

IF(

COUNTROWS(

FILTER(

FILTER(ALL('Tickets'),

SelectedTicket = 'Tickets'[Ticket ID]

),

EvalEndDate = 'Tickest'[Snapshot Date]
)

)>0,1,0

)

Return Result

 

 

DataInsights
Super User
Super User

@Ray_Brosius,

 

Try this solution.

 

1. Create separate tables for Start Date and End Date (no relationships):

 

DataInsights_0-1674925015394.png

 

2. Create measures:

 

Starting Status Count = 
CALCULATE (
    COUNT ( FactTable[Ticket ID] ),
    FactTable[Snapshot Date] = SELECTEDVALUE ( StartDate[Date] )
)
Starting Status Value = 
CALCULATE (
    SUM ( FactTable[Value] ),
    FactTable[Snapshot Date] = SELECTEDVALUE ( StartDate[Date] )
)
Ending Status Count = 
CALCULATE (
    COUNT ( FactTable[Ticket ID] ),
    FactTable[Snapshot Date] = SELECTEDVALUE ( EndDate[Date] )
)
Ending Status Value = 
CALCULATE (
    SUM ( FactTable[Value] ),
    FactTable[Snapshot Date] = SELECTEDVALUE ( EndDate[Date] )
)

 

3. Create slicers for Start Date (StartDate table) and End Date (EndDate table).

 

4. Result:

 

DataInsights_1-1674925219228.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for your reply but you did not provide a solution to the "challenging" aspsect of this. 

 

We want to show the Ticket "FLOW"..   

 

the number of tickets per status and the Value $$'s...At the START

  then for each Ticket Status show where the tickets ended up.  (See screenshot provided for expected output) The "FLOW"  # tickets at the start for each Status then show the Number of tickets by status that those tickets ended up in at the MAX of the Evaluation Date.. 

  • Example ( See Screenshot for expected output.)
  • For the 2 tickets that were in "New" with a value of $4 they ended up with 1  "In Progress" with a value of $1  and 1 "Closed" with a value of  $10.  
  • For the 1 ticket that was "In Progress" at $1  it ended up in "In Progress" with a value of $3

 

 

What is needed is a way to get the "Listing" of deals by status, at the start of the evaluation date, then use that "temporary" table to show how many by each status at the start,  and the ending Status Count

 

So if I had 100 Tickets in New at the Start.. I would find 100 tickets at the end.. but those 100 woudl be distributed across different status values.. that is the 100 tickets at the start could be in any one of the status's at the end.. 

@Ray_Brosius,

 

See if this works. I created a separate table EndingStatus to use in the Ending Status matrix. This allows you to control the filtering via DAX. This table can be created in Power Query or DAX, and has no relationships.

 

Calculated table:

 

EndingStatus = DISTINCT ( FactTable[Status] )

 

Modify the measures as follows:

 

Ending Status Count = 
VAR vStartTickets =
    CALCULATETABLE (
        VALUES ( FactTable[Ticket ID] ),
        FactTable[Snapshot Date] = SELECTEDVALUE ( StartDate[Date] )
    )
VAR vResult =
    CALCULATE (
        COUNT ( FactTable[Ticket ID] ),
        FactTable[Snapshot Date] = SELECTEDVALUE ( EndDate[Date] ),
        vStartTickets,
        TREATAS ( VALUES ( EndingStatus[Status] ), FactTable[Status] )
    )
RETURN
    vResult

 

Ending Status Value = 
VAR vStartTickets =
    CALCULATETABLE (
        VALUES ( FactTable[Ticket ID] ),
        FactTable[Snapshot Date] = SELECTEDVALUE ( StartDate[Date] )
    )
VAR vResult =
    CALCULATE (
        SUM ( FactTable[Value] ),
        FactTable[Snapshot Date] = SELECTEDVALUE ( EndDate[Date] ),
        vStartTickets,
        TREATAS ( VALUES ( EndingStatus[Status] ), FactTable[Status] )
    )
RETURN
    vResult

 

In the Ending Status matrix, use EndingStatus[Status] as columns:

 

DataInsights_0-1675005046608.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Very much appreciate your time and thoughts on this..  but this is not quite what we are after..  I simplified the expected output.

For each Status..

We want how many tickets were in each status at the start.

Then on the same line show for the tickets that were in each status, how many went to each possible status at the end.

 

 

Ray_Brosius_0-1675020021038.png

 

@Ray_Brosius,

 

This sounds like a visual issue (showing them on the same line). You could try customizing the native matrix to get it to display properly. Alternatively, you could try the Profitbase matrix or Inforiver matrix (they offer more features).





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.