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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
bluez
New Member

Calculating cost based on average ticket count

Hello,

 

I need some help with calculating the cost of tickets per site. 

 

A base rate of 100,000 for each agent (e.g. Alpha costs the company 100,000 to employ for the year, etc.) then take that rate and divide by the total tickets they created for each year to find out how much it costs for each ticket they created for that year. Then, take that cost per ticket and do a count of how much tickets they had for a particular site and do a sum of cost per site.

 

What I would like is something below: 

(100,000 / Total ticket Count for each year per agent) * (Ticket count for account that year) = Cost of supporting account per year(or month)

 

Sample Data:

Ticket NumberAgentDate OpenedAccount
001Alpha1/1/2022

Smith Co.

002Alpha5/9/2022

Johnson LLC

003Beta7/19/2023Smith Co.
004Delta12/13/2023Smith Co.
005Delta8/11/2022Johnson LLC.
006Beta9/22/2023Johnson LLC.
007Alpha11/29/2023Happy Corp
008Alpha12/16/2022Happy Corp
009Beta3/20/2022Happy Corp

 

I also have created data sheets to try and break it down but not quite sure how to relate the data properly back to the accounts.

 

Sample Data Ticket Count Per Year:

Agent2021 2022 2023 2024
Alpha3261289634
Beta485267234110
Delta36151364402

 

Sample Data Cost Per Ticket Per Year:

Agent2021202220232024
Alpha$306.75$781.25$1041.66$2941.17
Beta$206.18$374.53$427.35$909.09
Delta$2777.77$662.25$274.73$248.75
2 REPLIES 2
bluez
New Member

Hello @v-rzhou-msft,

 

I did an unpivot and got the new measure which is helpful. That solves part of my problem. How do I get that new measure to multiple by the number of tickets per account over the year and get a sum of the total cost? Since I would like the visual to be a column chart or something similar.

What I want:
new measure * number of tickets for account (but for each agent).
e.g.

Alpha cost $306.75 for each ticket created in 2021 but created 10 tickets for Smith Co.
Alpha total for Smith Co:

306.75 * 10 = 3067.50

 

Beta cost $206.19 for each ticket created in 2021 but created 5 tickets for Smith Co.

Beta total for Smith Co:

206.19 * 5 = 1030.95 

 

Total cost for Smith Co. = Alpha total + Beta Total + etc...


Then sum them all together over the year and to be able to slice the data with an account slicer to show the different accounts total throughout the years.

v-rzhou-msft
Community Support
Community Support

Hi @bluez ,

 

I suggest you to do some transformation on your Sample Data Ticket Count Per Year in Power Query Editor.

Use Unpivot function:

vrzhoumsft_0-1711616289167.png

Data model:

vrzhoumsft_2-1711616463415.png

Measure:

Measure = 
10000 / SUM('Ticket Count Per Year'[Value]) * CALCULATE(COUNT('Table'[Account]),ALL('Table'))

Result is as below.

vrzhoumsft_1-1711616425797.png

 

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.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.