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
Anonymous
Not applicable

Monthly ticket status across time

Hi forum,

I would need to present a ticket status summary at the end of each month based on ticket change log data. I have been trying to find ideas how to get this via various posts but no luck so far. For example this is somewhat close but not exactly fitting for my needs due to different type of source data.

 

My dataset is like this

Table: Status_Changes

IDDateOld_StatusNew_Status
10029.11.2020status3status4
10225.11.2020status3status4
10419.10.2020status3status4
10321.8.2020status2status3
10430.7.2020status2status3
1045.6.2020status1status2
1031.6.2020status1status2
10023.5.2020status2status3
10215.4.2020status2status3
10115.4.2020status3status2
10115.4.2020status2status3
10114.4.2020status1status2
1008.3.2020status1status2
1005.1.2020status0status1

 

There is a ticket ID, the date (or actually time) when the status was changed and the statuses from it was changed and to which status it was changed.

 

Out of this, I should provide something like this, where I have distinct count of tickets for each month per status

JabbaKyba_0-1608544566951.png

Each ticket should appear into the visual only on the month when the first status change is seen in the data. Once a ticket has reached the final status (status4 in the sample) it should disappear from the visual on the very next month (case ticket ID 104 on November/last column).

 

I was thinking to transform the source data into something like below where there would be row for each ticket that has been seen in the source data so far for each month and the latest New_Status that has been in the data.

And once a ticket is reached the status4, after a month it should be moved to status5. That can be considered as archived or similar in case that is interesting information later on. Status5 can be then left out from the visual.

 

But I don't know how to get this with DAX? Or is there some other way to get the visual I need?

Year_MonthIDLatest_Status
2020-11100status4
2020-11102status4
2020-11101status2
2020-11104status5
2020-11103status3
2020-10100status3
2020-10102status3
2020-10101status2
2020-10104status4
2020-10103status3
2020-09100status3
2020-09102status3
2020-09101status2
2020-09104status3
2020-09103status3
2020-08100status3
2020-08102status3
2020-08101status2
2020-08104status3
2020-08103status3
2020-07100status3
2020-07102status3
2020-07101status2
2020-07104status3
2020-07103status2
2020-06100status3
2020-06102status3
2020-06101status2
2020-06104status2
2020-06103status2
2020-05100status3
2020-05102status3
2020-05101status2
2020-04100status2
2020-04102status3
2020-04101status2
2020-03100status2
2020-02100status1
2020-01100status1

 

Any ideas are welcome.

 

 

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @Anonymous 

You do not show the numbers/dates in the chart so I'm not sure waht the expected result is exactly but see the attached file for a possible solution. It uses Latest_status in the legend of the chart and this measure: 

Measure = 
VAR status_ = SELECTEDVALUE(Table1[Latest_Status])
RETURN
IF(status_ <> "status5", DISTINCTCOUNT(Table1[ID]))

image.png

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

View solution in original post

5 REPLIES 5
AlB
Super User
Super User

@Anonymous 

Place the following M code in a blank query to see the steps. You might have to tweak it a bit to adapt it completely to your needs

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jdFBDoQgDAXQu7A2TX8L6pzFsPAM6v2lLhRGDOygeb9NYVkcmN3g5EcACYtdtn3dj03vk3dxMCgGQwf0qYLUkVvQKgKaSydZ4mmoTFOPCzSWDFngGYs2ux5GKbSmWgWBfMuh6vQ1t+4++vl/V99jJu1h6XdLlgdiPAE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Date = _t, Old_Status = _t, New_Status = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Date", type date}, {"Old_Status", type text}, {"New_Status", type text}}),
    transform_ = Table.TransformColumns(#"Changed Type",{"Date", each Date.StartOfMonth(_)}), 

    #"Added Custom" = Table.AddColumn(transform_, "NextDate", each List.Select(List.Dates([Date], let aux_ = List.Min(Table.SelectRows(transform_, (inner)=>inner[ID]=[ID] and inner[Date]>[Date])[Date]) in  if aux_ <> null then Duration.Days(aux_-[Date]) else 1 , Duration.From(1)), each Date.Day(_)=1)),
    #"Expanded Next date" = Table.ExpandListColumn(#"Added Custom", "NextDate"),
    #"Added Custom1" = Table.AddColumn(#"Expanded Next date", "Latest_Status", each if [NextDate]= [Date] then [New_Status] else null, type text),
    #"Filled Down" = Table.FillDown(#"Added Custom1",{"Latest_Status"}),
    #"Removed Columns" = Table.RemoveColumns(#"Filled Down",{"Date", "Old_Status", "New_Status"})
in
    #"Removed Columns"

 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Anonymous
Not applicable

I mean,

The measure you provided is using the later example table to count the value. But I don't have that table yet. It is just hand made example that I would like to get based on the source data.

 

I have the source data in PowerBI as table like this

Table: Status_Changes

IDDateOld_StatusNew_Status
10029.11.2020status3status4
10225.11.2020status3status4
10419.10.2020status3status4
10321.8.2020status2status3
10430.7.2020status2status3
1045.6.2020status1status2
1031.6.2020status1status2
10023.5.2020status2status3
10215.4.2020status2status3
10115.4.2020status3status2
10115.4.2020status2status3
10114.4.2020status1status2
1008.3.2020status1status2
1005.1.2020status0status1

 

How can I transform that with DAX into table like the one below to be able to visualize the data as expected? This could be then used to calculate the measure you suggested.

 

Let call this for example Table: Latest_Statuses_Per_Month

Year_MonthIDLatest_Status
2020-11100status4
2020-11102status4
2020-11101status2
2020-11104status5
2020-11103status3
2020-10100status3
2020-10102status3
2020-10101status2
2020-10104status4
2020-10103status3
2020-09100status3
2020-09102status3
2020-09101status2
2020-09104status3
2020-09103status3
2020-08100status3
2020-08102status3
2020-08101status2
2020-08104status3
2020-08103status3
2020-07100status3
2020-07102status3
2020-07101status2
2020-07104status3
2020-07103status2
2020-06100status3
2020-06102status3
2020-06101status2
2020-06104status2
2020-06103status2
2020-05100status3
2020-05102status3
2020-05101status2
2020-04100status2
2020-04102status3
2020-04101status2
2020-03100status2
2020-02100status1
2020-01100status1

 

Or, can I get the targetted visualization done by some other way based on the Status_Changes table?

 

AlB
Super User
Super User

@Anonymous 

I don't understand the question

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Anonymous
Not applicable

Thanks, the chart is like expected. I need to test the measure as well but it looks like something I'm looking at.

 

But how can I transform from the source data table to the target table?

AlB
Super User
Super User

Hi @Anonymous 

You do not show the numbers/dates in the chart so I'm not sure waht the expected result is exactly but see the attached file for a possible solution. It uses Latest_status in the legend of the chart and this measure: 

Measure = 
VAR status_ = SELECTEDVALUE(Table1[Latest_Status])
RETURN
IF(status_ <> "status5", DISTINCTCOUNT(Table1[ID]))

image.png

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

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.