Prebid setup with bidders which have different currencies - google-ad-manager

I have a simple Prebid setup with 2 bidders. I donot use "Send all bids to the ad server" feature. So Prebid works RTB with returning bids and sends the winning bids to Google Ad Manager (GAM) with key/value pairs like:
hb_bidder=bidder_A
hb_pb=0.10
hb_bidder=bidder_B
hb_pb=0.20
Off course there are line-items defined in GAM with the key/value pairs with those values above.
There is no problem in this setup, if all bidders use same currency.
What if bidder_A bids in USD and bidder_B bid in TRY
Line items' currency of bidder_A were set to USD
Line items' currency of bidder_B were set to TRY
Note: It's possible to use different currencies in GAM 360)
Scenario:
1 USD = 8 TRY
Bidder
Bid
Currency
A
1
USD
B
5
TRY
In this scenario, bidder B wins which is wrong. Currencies donot affect prebid RTB if I am not wrong. When I checked the GAM request, it verifies me.
When I use Prebid Currency Module; it converts USD to TRY (1*8=8) for bidder A, and in this case winner is bidder A which is correct one.
Prebid Currency Module fixes the RTB problem but Prebid sends converted bid
hb_pb=8 (TRY), hb_bidder=bidder_A to GAM. In GAM side, line items of bidder_A defined with currency USD not TRY. So bid matches wrong line-item.
"Send all bids to the ad server" maybe solution but it's needed too much work.
I know, it's very complicated case, what do you suggest to fix problem?

While setting up Prebid Currency Module, there's a configuration parameter adServerCurrency which should match your ad server (usually GAM) currency setting.
In GAM side, line items of bidder_A defined with currency USD not TRY. So bid matches wrong line-item.
So in this case, you need to set adServerCurrency to USD because GAM line items are defined with currency USD.

Related

How do I include a 'between two dates' IF AND formula inside of a SUMIFS formula?

I am doing a personal budgeting project. I have 2 excel files - 1 is detail of my last 5 years banking activity, the other is an annual monthly summary and analysis (S/A) file - so 12 worksheets inside the one workbook.
I am trying to find a way to make the S/A file more dynamic so I can copy 1 formula to the various fields that look up and sum detail activity equal to or after the first date but before the 2nd date BUT ONLY for lines that match the category found in Column B of the S/A file worksheet. This gives me the activity in my budget categories between 1 paydate and the day before the next paydate.
Example: I want to find and sum all the amounts (Detail file $F:$F) in my detail file that are for Cell Phone payments (Detail File $E:$E, matching S/A field B6) where the transaction date (Detail file $A:$A) is on or after 7/14/2017 (start Date, S/A field E5) but before 7/28/2017 (end date, S/A field E33).
This is what I have tried:
=IF(AND('[2016-Present Bank Statements.xlsx]Checking TRX'!$A$2:$A$2959>(E5-1),'[2016-Present Bank Statements.xlsx]Checking TRX'!$A$2:$A$2959<E33),SUMIF('[2016-Present Bank Statements.xlsx]Checking TRX'!$E$2:$E$2959,B6,'[2016-Present Bank Statements.xlsx]Checking TRX'!$F$1:$F$2959),0)
I was getting an error trying to put ">=" into the first component so I put the cell reference -1 to get the previous date from my starting date. So anything greater than E5-1 should include the date in E5 (because let's face it, we all go mad spending on payday).
=SUMIFS('[2016-Present Bank Statements.xlsx]Checking TRX'!$F:$F,'[2016-Present Bank Statements.xlsx]Checking TRX'!$E:$E,B6,'[2016-Present Bank Statements.xlsx]Checking TRX'!$A:$A,"E5≤x<E33")
The last part "E5≤x<E33" I found on the interwebs for comparing dates.
I have tried breaking out the greater than/equal to and less than statements into 2 criteria in a SUMIFS, but no luck.
I either get back 0.00 or #SPILL
These are the headers in my details file. Do I need to rearrange them to get either of these formulas to pick up the right amount?
Date|Account|Merchant|Description|Category|Amount
My current process is to do a SUMIF but have it reference the specific lines that related to the start and end dates. I've gotten off somehow between yesterday and today and don't want to redo all my tabs so far.
=-SUMIF('[2016-Present Bank Statements.xlsx]Checking TRX'!$E$2076:$E$2168,B6,'[2016-Present Bank Statements.xlsx]Checking TRX'!$F$2076:$F$2168)
Please help!!!
Use SUMIFS. Something like:
=SUMIFS(sum_range,
type_range, type,
date_range, ">"&start_date,
date_range, "<"&stop_date)
Obviously replace ">" with ">=" if you see fit. See the simple example below.

I'm trying to get Last month to date in Power BI

I have a Power Bi dashboard tracking several metrics since the beginning of last month . Some of the comparisons I make are MTD vs Last MTD count of metrics like Total users, No of posts and connections made.
MTD(June) and LMTD(May) were working well last month(June) but when we moved to a new month(july) the numbers are off.
Here's my measure
MTD_Users = CALCULATE(COUNTROWS('reporting profiles'), FILTER('reporting profile', MONTH('reporting profile'[date_created])=MONTH(TODAY())))
LMTD_USERS = CALCULATE(COUNTROWS('reporting profiles'), FILTER('reporting profile', MONTH('reporting profile'[date_created])=MONTH(TODAY())-1))
Since July 2nd these measures are not displaying correct figures for MTD(July 1st) and LMTD(June 1st)
Any advice/assistance will be highly appreciated
You need to ride off contex filter and that mean we must use function ALL or REMOVEFILTERS;
https://dax.guide/removefilters/
https://dax.guide/all/
LMTD_USERS = CALCULATE(COUNTROWS('reporting profiles'), FILTER(ALL('reporting profile'[date_created])), MONTH('reporting profile'[date_created])=MONTH(TODAY())-1))

How to have Running Count Items Within a Start and End Date in Amazon Quicksight

I have data like this brought into a SPICE from Redshift:
BadgeAward StartDate EndDate
Bronze 1/15/2017 1/15/2020
Silver 2/15/2019 2/15/2020
Gold 3/15/2017 3/15/2020
Gold 3/15/2017 3/15/2020
I am putting a line graph to show at a point in time (StartDate), how many are active
At 1/15/2017, Total Badges = 1 (Only Bronze is active)
At 2/15/2019, Total Badges = 4 (Gold,Bronze and Silver are still active)
At 3/15/2017, Total Badges = 3 (Gold and Bronze are active, Silver has not started yet)
I have been playing around with RunningCount but cannot seem to get it right.
I recreated your data set and what I thought would work with a runningcount formula. As you pointed out, it doesn't seem to work. QuickSight appears to be applying a distinct_Count logic as a part of the runningcount formula instead of a pure count.
To get around the issue I create a separate calculated field in which I assigned a value of 1 to assign a 1 to every row in the data. Then I did a runningsum formula based off that field to get your desired output.
BadgeCount = runningsum(sum(1),[STartDate ASC],[])

Trying to scrape substrings within paragraphs using regex

Main questions I have:
RegEx practices for statements that are close but not similar iterated through a list of websites when dealing with doubles and text
Should I pull all of the text then parse out what I want in the following code? Or is there a better way?
I am currently trying to extract interest rate data from different lenders using regular expression. I want to use regex because I want to be able to add more URLs as more lenders arise. I want the extracted information to basically take on the form of:
x.xx% - xx.xx% (the low - high bands of the interest rates)
Most of the websites vary in how they present this, some examples:
APR ranges from x.xx% to xx.xx%
Rates range from x.xx% to xx.xx%
x.xx% - xx.xx%
range from x.xx% (AA) to xx.xx% (HR)
Currently I am trying to just grab the paragraph the text lives in and then make substrings off of that to create the final piece of information I need (x.xx% - xx.xx%). Not sure if this is the best method, but would like to crowdsource my issue.
plcompetitors = ['https://www.lendingclub.com/loans/personal-loans',
'https://www.marcus.com/us/en/personal-loans',
'https://www.discover.com/personal-loans/',
'https://www.lightstream.com/',
'https://www.prosper.com/']
#cycle through links in array until it finds APR rates/fixed or variable using regex
for link in plcompetitors:
l = r.get(link)
l.encoding = 'utf-8'
data = l.text
soup = bs(data, 'html.parser')
paragraph = soup.body.findAll(text=re.compile('% APR'))
#using this next if statement to try and iterate through what turned up empty in the initial pass through with the first .compile statement
if paragraph == []:
paragraph = soup.body.findAll(text=re.compile('% - [0-9]'))
print(paragraph)
Which returns this:
[]
[]
[' 6.99% to 24.99% APR']
['\r\n Payment example: Monthly payments for a $10,000 loan at 3.09% APR with a term of 3 years would result in 36 monthly payments of $291.21.', 'The lender’s interest rate (APR) must not be supported by any third-party arrangements such as vehicle manufacturer subvention payments (with rates as low as 0.0% APR), other manufacturer discounts, rate buy-downs by car buying services or any other\n similar third-party subsidized rate offerings.']
['* For example, a three-year $10,000 loan with a Prosper Rating of AA would have an interest rate of 5.31% and a 2.41% origination fee for an annual percentage rate (APR) of 6.95% APR. You would receive $9,759 and make 36 scheduled monthly payments of $301.10. A five-year $10,000 loan with a Prosper Rating of A would have an interest rate of 8.39% and a 5.00% origination fee with a 10.59% APR. You would receive $9,500 and make 60 scheduled monthly payments of $204.64. Origination fees vary between 2.41%-5%. APRs through Prosper range from 6.95% (AA) to 35.99% (HR) for first-time borrowers, with the lowest rates for the most creditworthy borrowers. Eligibility for loans up to $40,000 depends on the information provided by the applicant in the application form. Eligibility is not guaranteed, and requires that a sufficient number of investors commit funds to your account and that you meet credit and other conditions. Refer to Borrower Registration Agreement for details and all terms and conditions. All loans made by WebBank, member FDIC.']

Tax based on currency in Opencart

At present the tax seems to display based on the location of the logged in customer.
This can't work for me for 2 reasons. I have an extension that auto displays the currency based on the customers ip plus there is no option for logging in, it's guest checkout only.
So I really need it to display the correct price based on the currency displayed instead.
Does anyone have any idea where the code is for this please or how to adjust the displayed price properly?
Any help is greatly appreciated.
Thanks
-James
I guess You should extend the extension You are using for displaying of currency based on IP address.
Find the line of code where the currency based on user's IP address is populated and call this:
$this->currency->set($currency_code);
where $currency_code should be a 3 character currency ISO code (e.g. USD, EUR, etc) of currency set in the administration.
This way You set the currency to use for price calculation - and that reflects the currency based on user's IP address. This currency code is then saved to session and cookie so it should work on any page within OpenCart frontend.
I think so
Returns 3-character ISO 4217 currency code for the currently set currency.
// Return when Pound Sterling is the set currency
$currency_code = $this->currency->getCode();
var_dump($currency_code); // string 'GBP' (length=3)
also you can
$this->currency->set($currency_code);
and please find currency file https://github.com/opencart/opencart/blob/master/upload/system/library/currency.php
Thanks
I think I have found the correct way to do this: Go to file system/library/tax.php.
Line 27:
if(!$reg){
if($currentCurrency == "CHF"){
$country_id = 204;
}else if($currentCurrency == "EUR"){
$country_id = 81;
}
}
This will set the country the user is in according to the selected currency and will set the country for tax calculation.