get top spending resources with azure api - azure

I am a daily user of Azure and quite familiar with Logic Apps and other Azure tools.
I have 2 requirements,
1. To get an email everyday consisting list of top 25 resources which consumed the most credit amount on the previous day.
2. Get total spent amount of the previous day by all the resources in my subscription.
I achieved part 2 by setting up a budget and got daily spent from it through budgets API.
I want to achieve the same with part 1 of my requirement using any API provided by azure.
Please help or drop any questions. I'll be happy to explain.a

I think you are looking for Usage Details API, see here
Its List operation allow you to get the usage details where you can filter by date (startDate and endDate in headers). There is a $top parameters to limit the number of results, but it looks like they are not ordered by amount so you may have to do you own sort to limit to the 25 highest costs

Related

Choosing the right Stripe subscription model if pricing depends on another numerical attribute

I have little experience with payment gateways, and am trying to figure out how to synthesize the type of subscription billing that I am looking for: the monthly price gets rebalanced once a year, based on another attribute (a number that can get as high as seven or eight digits).
So, for example, the monthly subscription price as of January 1st will be a % of a user's credit card debt balance as of Dec 15th in the prior year. But the debt balance can get very high / does not have a cap.
I looked at the Stripe documentation to figure out of there's a way to do this. The only thing I could come up with is to use unit_amount in metered pricing and tying this to the credit balance. In other words, I would grab the debt balance number and use it as the unit_amount, and then apply a %. But then I need to also forward bill, so I trick the logic into shifting by a month, which seem impractical.
Alternatively, I am not sure I could do this with per seat pricing (e.g. $1 in debt = 1 seat). But I assume there's a max to the number of seats (i.e. someone cannot have, say 1m seats). I just couldn't determine this from the documentation...
That's what I was thinking, anyway. Perhaps there's a better way?
You've got a couple different options here:
At the start of the year you update the Subscription to a new price based on the calculations of the customer's credit card debt balance by specifying items[0].price_data. Setting items[0].price_data (see the api ref) allows you to create an "in-line price" that as part of the updating the Subscription, so you don't have to create one separately through a separate API request. If you haven't seen Stripe's docs on how to update the price of a Subscription you can see an example here, and you'll likely want to read about proration_behavior as well.
You have a single Price where 1 seat = $1 in debt, and you control how much you want to charge by changing the number of seats for the Subscription. I don't think Stripe has a limitation to the number of seats (as long as it's a valid integer), but they do have a limitation on the maximum amount you can charge which you can read about here. For USD the maximum charge amount is $999,999.99, so the maximum quantity would be you could specify for a $1 price is 999,999.
You could look into using metered pricing, but given that you don't want to bill at the end of the billing cycle the other two options seem better.
I think the first option (updating the price year by year) is your best one, but definitely try all of them out in test mode and take a look at how the Invoices look to see which one you like best.

How to score different Ads based on data of sequential steps in a sales funnel?

we run an eCommerce store and constantly create & test new Facebook Ads. Now I am looking for a good way to create a scoring for these ads. Basically it is a very simple problem, but I can't get my head around it.
For each Facebook Ad, I have this data:
Budget Spent
Impressions
Clicks
Product Page Visited
Purchases
The most important event obviously is the purchase. So in a perfect world with huge amount of data per ad I would simply calculate the cost per purchase (= Budget Spent / Purchases) and know, which is my best ad. But here comes the problem..
On each ad we don't have much data. So let's say we have:
AD 1
50€ Budget Spent
10.000 Impressions
200 Clicks
50 Product Page Visits
2 Purchases
= 25€ per purchase
AD 2
50€ Budget Spent
10.000 Impressions
400 Clicks
130 Product Page Visits
1 Purchases
= 50€ per purchase
Simply based on the cost per purchase, I would choose AD1. But when I am looking at the data of the previous steps (clicks and product-page-visits), AD2 looks more promising.
How can I create a score value, that tells me which ad will likely generate the better cost per purchase in the long run, considering also the values of the previous steps?
That score value should take into account the data of the previous steps. So if we have less purchase-data, it should strongly rely on the previous data and if we have much purchase-data, it should rely less on previous data (and more on the actual cost per purchase).
I think of something like:
Use the click-rate as the base score (because we have much data for this)
then modify that score with the values of the following steps but in a weighted-way. So the more data we have on the following steps, the more the score moves toward that values.
Thanks in advance for your help!
Best Regards
Patrick

Azure Devops Query to find Daily hours spent on Work item

I have to find out time spend by a resource on a Task.
let say,
There are 3 Task (Task-A,Task-B,Task-C)
There are 3 User (User-A,User-B,User-C)
All the Task have Original estimate of 8 hours
on Day 1 All the User have work 2 hours on their respective tasks
So I should get a result of 2
I am using Azure Work Item query to calculate and display the results.
I am not understanding what should be done to calculate the daily work done on a task.
For this issue , you can add Completed Work and Remaining work column to the query.This can show the hours the tasks has spent and remaining work hours in the query.
Based on these two fields, you can calculate the daily hours spent on work item.
Azure Devops Query to find Daily hours spent on Work item
AFAIK, Azure devops does not focus on micromanaging and focus on low value metrics.
So, Azure devops doesn't track the time spent on a per day basis. It keeps track of the total time spent. If you want a per person per day value, you'll have to go through the iterations/workitem history and calculate the running difference.
If you really looking for a TimeReporting for the work items of per person, I suggest that you take a look at a third party yool like Timetracker:
Timetracker
New to version 5.0.! Individual, team, and custom reports powered by
version 3 of the REST-based reporting API. 7+ customizable widget
types that let you see data that you need, how you need it. In
addition to the six default reports in Reporting, users can create
custom reports for individuals or teams.
Hope this helps.
You can Analinics Views and Power BI. For example, you can add your custom view:
Then use it in Power BI:

Series Design in Influxdb for showing number of repeat customers

Consider an analytics where you need to find out repeat customers for a date range. Repeat customers are defined for date range as customers who use the service 3*(Given Date Range Interval) before the starting range and also used the service in given date range.
For example repeat customer for this week is all customers who used service 3 weeks before starting of this week and all such customers used it this week.
I am using influxdb. I haven't decided the series yet, I am looking for inputs into how I can define a series such that I can do available operations in influxdb to obtain this analytics.
Data available to me is the timestamp at which user used the facility, user_id , service_category, service_instance_id, and a json dump of further details about service.
may be my thought process is limited, I need some intervention on how to approach this and any input is welcome.
So I thought about this and came to a decent solution. I have to save the last time a user visited along with the entry. So at least one reference will be there for any time period if user is repeating for that time period.
This is similar to a linkedlist except that we have direct access to time based filtering of nodes.

Giving Stripe Customers Credit

I'm working with Stripe. Our users subscribe to our service and they are billed every 2 weeks. We need to implement a way to give them $5 credit every time they refer someone to use our service.
Solutions I have considered so far:
Stripe coupons: Stripe has great documentation. Unfortunately, for
coupons there are many ambiguities. I tried working with coupons but
so far it seems like a coupon can only be applied once for each
invoice, and you can't apply multiple coupons for one invoice. This will not work with us since a user can earn $5 multiple times during the billing period.
Issuing refund: the problem with this is that we have to pay the user actual money while what we actually want is to give them credit to use in our service.
Am I missing anything with coupons? Are there any other solutions/suggestions?
If I understand your use case correctly, I think the best way would be to create an invoice item with an amount of -500 for each referral. When you create an invoice item, by default it is set as "pending" and will automatically be included in the next invoice, i.e. at the end of the current billing period.
Be aware that if the invoice's total is negative (in the case of many referrals), then the total will be added to the customer's account_balance and reduce the amount of the next invoice as well. If this isn't what you want, you'd need to reset the customer's account_balance to zero, or make sure that you don't create invoice items that will make the invoice's total go below zero.
More information about invoice items can be found here: https://stripe.com/docs/subscriptions/guide#adding-invoice-items. The guide only mentions invoice items with positive values (i.e. additional charges), but you can use negative values as well.
Have you considered just checking for available credit in transactions before you charge?
That way you can just store how much credit people currently have in some database, and just apply the balance on transactions. AKA charge them for full_price - total_credits.

Resources