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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MaironDominguez
Frequent Visitor

Help with a Calculated Column

Greetings,

I need help with the code of a calculated column, what I need is that having an initial date, all the tickets of a certain it staff can be organized considering the estimated resolving time.

MaironDominguez_0-1691076752851.png

 

The idea is that having itstaff Jack, today's date is used for the ticket that is ranked number 1, ranking number 2 will have as its start date the result of adding the start date of ranking 1 and the estimated resolving time, in the same way the start time of ranking number 3 will be calculated. Below I give an example of how what I want would look graphically;

MaironDominguez_1-1691076757396.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @MaironDominguez ,

 

Due to today is 8/7/2023, here I use 8/4/2023 as today to have a test to try to get the result you want.

StartDate = 
VAR _TODAY =
    DATE ( 2023, 08, 04 )
RETURN
    IF (
        Table1[Ranking] = 1,
        _TODAY,
        _TODAY
            + CALCULATE (
                SUM ( Table1[Estimated Resolving Time (Days)] ),
                FILTER (
                    ALLEXCEPT ( Table1, Table1[ITStaff] ),
                    Table1[Ranking] < EARLIER ( Table1[Ranking] )
                )
            )
    )
EndDate = Table1[StartDate]+Table1[Estimated Resolving Time (Days)]

Result is as below.

vrzhoumsft_0-1691399469623.png

If you want to dynamic today value, you can replace DATE(2023,08,04) by TODAY().

 

Best Regards,
Rico Zhou

 

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

 

View solution in original post

7 REPLIES 7
MaironDominguez
Frequent Visitor

Understood, im pasting the table that represents my situation for best understanding.

RankingITStaffTicket NumberEstimated Resolving Time (Days)StartDateEndDate
1Jack1101  
1Nate1112  
1Nick1124  
1Josh1132  
2Jack1141  
2Nate1153  
2Nick1165  
2Josh1174  
3Jack1182  
3Nate1192  
3Nick1203  
3Josh1216  
4Jack1223  
4Nate1233  
4Nick1243  
4Josh1252  

 

ranking is the order of priority that the ticket has for each it staff, there is also the ticket number and the estimated resolving time (days), what I need are two calculated columns.

The start date computed column should have the value of Today() if the ticket rank is 1, but for ticket rank 2, the start date should be today() + estimated resolving time (days) of the rank ticket 2, for the rank 3 ticket the start date must be the rank 2 ticket start date + the rank 2 ticket estimated resolving time and so on.
The end date in each case must be the start date + estimated resolving time.

The ideal results for the example table would be the following;

 

RankingITStaffTicket NumberEstimated Resolving Time (Days)StartDateEndDate

1Jack110108/04/2308/05/23
1Nate111208/04/2308/06/23
1Nick112408/04/2308/08/23
1Josh113208/04/2308/06/23
2Jack114108/05/2308/06/23
2Nate115308/06/2308/09/23
2Nick116508/08/2308/13/23
2Josh117408/06/2308/10/23
3Jack118208/06/2308/08/23
3Nate119208/09/2308/11/23
3Nick120308/13/2308/16/23
3Josh121608/10/2308/16/23
4Jack122308/08/2308/11/23
4Nate123308/11/2308/14/23
4Nick124308/16/2308/19/23
4Josh125208/16/2308/18/23

 

The idea is that by choosing a date for the ticket in rank 1 of each itstaff, the dates of the other tickets can be organized automatically.

In the visual that I want to use, it should ideally look as follows.

MaironDominguez_0-1691153923069.png

 

 

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot).

This in te link to the PBI File;

PBI File

This one is for the excel file im using as a Data Source;

Excel File 

Anonymous
Not applicable

Hi @MaironDominguez ,

 

Due to today is 8/7/2023, here I use 8/4/2023 as today to have a test to try to get the result you want.

StartDate = 
VAR _TODAY =
    DATE ( 2023, 08, 04 )
RETURN
    IF (
        Table1[Ranking] = 1,
        _TODAY,
        _TODAY
            + CALCULATE (
                SUM ( Table1[Estimated Resolving Time (Days)] ),
                FILTER (
                    ALLEXCEPT ( Table1, Table1[ITStaff] ),
                    Table1[Ranking] < EARLIER ( Table1[Ranking] )
                )
            )
    )
EndDate = Table1[StartDate]+Table1[Estimated Resolving Time (Days)]

Result is as below.

vrzhoumsft_0-1691399469623.png

If you want to dynamic today value, you can replace DATE(2023,08,04) by TODAY().

 

Best Regards,
Rico Zhou

 

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

 

The following is happening: in some cases, there is a gap between the end date of one ticket and the start date of the next, theoretically that shouldn't happen (indicated with arrows). There's also the case (indicated with a dash) where a ticket hasn't ended when the next one starts. I would like to review this. I would also like to add that if a ticket starts or ends on a Saturday or Sunday, it should start or end on the following Monday.

MaironDominguez_0-1691675784741.png

 

 

Thank you very much, i really appreciate it. I am going to try to adapt this method to the real data and if I have any inconvenience I will let you know in this way.

foodd
Community Champion
Community Champion

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot).

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.