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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculating count of sub-tickets

Hello All, 

I'm trying to calculate how many sub-requests I have per request. Our structure (issue_type) is request, vendor, and sub-request (this is language). Each vendor can have multiple sub-requests (languages). I'm trying to get the the total requested languages per request. 

Please note sub-requests have parent ID in them, however vendor does not have child ticket field in there. The connection between vendor & Request is found in tab two outward/inward connections. 

I am attaching xls for reference.

Thank you very much for your help 

 

Issue_IdKeyIssue_Type_IdIssue_Type_NameGross_WordcountTarget_Language_SelectedUnit_rateFeesLanguage_QuoteWeighted_wordcountTotal_QuoteVendor_QuoteVendorParent_Issue_KeyParent_Issue_Type_Name
342144LOCAT-2920910606Request200 0000€ 111.430   
342158LOCAT-2921913809Vendor0 0000€ 0.0018.96osmicka Hong Kong  
342157LOCAT-2921813809Vendor0 0000€ 0.006.083Dimlight  
342156LOCAT-2921713809Vendor0 0000€ 0.0011.06Latis Global  
342155LOCAT-2921613809Vendor0 0000€ 0.0013.035osmicka Japan  
342154LOCAT-2921513809Vendor0 0000€ 0.005.135Quoted  
342153LOCAT-2921413809Vendor0 0000€ 0.005.309Qloc  
342152LOCAT-2921313809Vendor0 0000€ 0.0012.166Local Heroes  
342151LOCAT-2921213809Vendor0 0000€ 0.0018.128Seamonkeys  
342150LOCAT-2921113809Vendor0 0000€ 0.0010.428Mouse Power  
342164LOCAT-2922513808Sub-Request0POLISH (PL)0.0640.055.30979€ 0.000QlocLOCAT-29214Vendor
342170LOCAT-2923113808Sub-Request0THAI (TH)0.1209.4879€ 0.000osmicka Hong KongLOCAT-29219Vendor
342169LOCAT-2923013808Sub-Request0TRADITIONAL CHINESE (TCH)0.1209.4879€ 0.000osmicka Hong KongLOCAT-29219Vendor
342167LOCAT-2922813808Sub-Request0KOREAN (KR)0.14011.0679€ 0.000Latis GlobalLOCAT-29217Vendor
342165LOCAT-2922613808Sub-Request0PORTUGUESE (BR)0.06505.13579€ 0.000QuotedLOCAT-29215Vendor
342168LOCAT-2922913808Sub-Request0SIMPLIFIED CHINESE (SCH)0.070.16.08379€ 0.000DimlightLOCAT-29218Vendor
342166LOCAT-2922713808Sub-Request0JAPANESE (JP)0.150.113.03579€ 0.000osmicka JapanLOCAT-29216Vendor
342163LOCAT-2922413808Sub-Request0DUTCH (NL)0.140.112.16679€ 0.000Local HeroesLOCAT-29213Vendor
342162LOCAT-2922313808Sub-Request0ITALIAN (IT)0.110.19.43878€ 0.000SeamonkeysLOCAT-29212Vendor
342161LOCAT-2922213808Sub-Request0SPANISH (ES)0.10.18.6979€ 0.000SeamonkeysLOCAT-29212Vendor
342160LOCAT-2922113808Sub-Request0GERMAN (DE)0.120.110.42879€ 0.000Mouse PowerLOCAT-29211Vendor
342159LOCAT-2922013808Sub-Request0FRENCH (FR)0.1280.111.12379€ 0.000Keywords FranceLOCAT-29210Vendor
1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

@Anonymous , so you need a calculated column, not a measure?

1. Set a Whole number type for _Request column:

ERD_0-1703863872555.png

2. Use this code:

subrequests = 
VAR current_req = Data[Issue_Id]
VAR subs =
    CALCULATE (
        COUNT ( Data[Issue_Id] ),
        Data[_Request] = current_req,
        Data[Issue_Type_Name] = "Sub-Request",
        ALLEXCEPT ( Data, Data[_Request] )
    )
RETURN
    subs

ERD_1-1703864201400.png

3. If you need any other calculations, just use the appropriate columns:

subrequests = 
VAR current_req = Data[Issue_Id]
VAR subs =
    CALCULATE (
        COUNT ( Data[Issue_Id] ),
        Data[_Request] = current_req,
        Data[Issue_Type_Name] = "Sub-Request",
        ALLEXCEPT ( Data, Data[_Request] )
    )
RETURN
    subs * Data[Gross_Wordcount] * 0.15 - Data[Total_Quote]

 

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

7 REPLIES 7
ERD
Community Champion
Community Champion

Hi @Anonymous ,

One of the ways to achieve this (calculate sub-requests per request) is to:

1. Create 2 calculated columns:

_Parent_Id =
SWITCH (
    Data[Issue_Type_Name],
    "Request", Data[Issue_Id],
    "Sub-Request", Data[Parent_Issue_Id],
    "Vendor",
        LOOKUPVALUE (
            Connections[Issue_Link_Id],
            Connections[Issue_Id], Data[Issue_Id]
        )
)
_Request =
VAR _path = PATH ( Data[Issue_Id], Data[_Parent_Id] )
VAR _item = PATHITEM ( _path, 1 )
RETURN
    _item

2. Create a measure:

subrequests =
VAR current_req = SELECTEDVALUE ( Data[Issue_Id] )
VAR subs =
    CALCULATE (
        COUNT ( Data[Issue_Id] ),
        Data[_Request] = current_req,
        Data[Issue_Type_Name] = "Sub-Request",
        ALLEXCEPT ( Data, Data[_Request] )
    )
RETURN
    subs

ERD_0-1703682234590.png

 

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

Hey @ERD , 

I think I almost have it 🙂 except i wanted to ask if I can create a new column in stead of measure? Or Should I copy it over so I can compare it visually? (I don't see the measure as a new column) And i was going to figure the cost savings now by doing (#of subrequests * gross word count * .15 subtracted by total cost) to get cost savings, and I'm stuck on how to add or visualize on this measure. Thanks a lot 🙂 

Boarderz22lb_0-1703776935935.png

 

ERD
Community Champion
Community Champion

@Anonymous , so you need a calculated column, not a measure?

1. Set a Whole number type for _Request column:

ERD_0-1703863872555.png

2. Use this code:

subrequests = 
VAR current_req = Data[Issue_Id]
VAR subs =
    CALCULATE (
        COUNT ( Data[Issue_Id] ),
        Data[_Request] = current_req,
        Data[Issue_Type_Name] = "Sub-Request",
        ALLEXCEPT ( Data, Data[_Request] )
    )
RETURN
    subs

ERD_1-1703864201400.png

3. If you need any other calculations, just use the appropriate columns:

subrequests = 
VAR current_req = Data[Issue_Id]
VAR subs =
    CALCULATE (
        COUNT ( Data[Issue_Id] ),
        Data[_Request] = current_req,
        Data[Issue_Type_Name] = "Sub-Request",
        ALLEXCEPT ( Data, Data[_Request] )
    )
RETURN
    subs * Data[Gross_Wordcount] * 0.15 - Data[Total_Quote]

 

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

Hey @ERD , 

Can I ask how you set up relations in connections & Data? I'm trying to think where I could have done something wrong, I used the data/formula you gave me, however it does not populate the Vendor tickets, furthermore _parent_ID & _Request are populated with the ID of the ticket itself not parent/child. 

Boarderz22lb_0-1704278991732.png

Boarderz22lb_1-1704279170121.png

 

 

123abc
Community Champion
Community Champion

Create a New Measure: You'll want to create a new measure that calculates the count of sub-requests per request.

 

TotalRequestedLanguages =
COUNTROWS(
FILTER(
'YourTableName',
'YourTableName'[Issue_Type_Name] = "Sub-Request"
)
)

 

  1. Replace 'YourTableName' with the name of your table where you imported the data.

  2. Visualize the Data:

    • Drag and drop the Issue_Id and TotalRequestedLanguages into a table or a matrix visualization.
    • Now, you should see a list of Issue_Id along with the total count of sub-requests (languages) for each request.
  3. Further Analysis (Optional):

    • You can further break down this analysis by vendor or other dimensions if needed. You can create additional measures or use slicers to filter your data accordingly.
  4. Refining the Data Model:

    • Make sure that your relationships in Power BI are correctly set up to establish the connection between requests and sub-requests. You might need to set up relationships between Issue_Id and Parent_Issue_Key if it's not done automatically.
    • If there are any inconsistencies or errors in your data, you might need to clean or transform your data in Power Query Editor before proceeding with calculations.

Remember, the steps provided give you a basic approach to determine the count of sub-requests per request. Depending on your specific requirements and the complexity of your dataset, you might need to adjust or refine these steps accordingly.

Anonymous
Not applicable

Hey @123abc , 

Thanks for the reply, however this only gives the sum/even when i do count it does not calculate the sub-request per request. 

Fowmy
Super User
Super User

@Anonymous 

It will be helpful ifyou could share the expected output based on the attached sample. Add an additional sheet with the results that you need.


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.