Microstrategy selector metric - selector

I have made a metric selector to visualize on a board, using an attribute with the name of the metrics and a metric with a 'case', the selector works fine, but the values are unformatted, some idea of how to format them? The number format does not work anywhere on the board.
I hope you can give me a hand, thanks
edit:
code of metric
Case(([Metric Selector]="Real Vol");vol_real01;([Metric Selector]="Real Spd");(spd_real02*100);([Metric Selector]="Real Res");res_real01;([Metric Selector]="Ppto Vol");vol_ppto01;([Metric Selector]="Ppto Spd");(spd_ppto02*100);([Metric Selector]="Ppto Res");res_ppto01;([Metric Selector]="R Vol Ant");vol_realant01;([Metric Selector]="R Spd Ant");(spd_realant02*100);([Metric Selector]="R Res Ant");res_realant01;([Metric Selector]="P Vol Ant");vol_pptoant01;([Metric Selector]="P Spd Ant");(spd_pptoant01*100);([Metric Selector]="P Res Ant");res_pptoant01;"")

Related

RStudio Error: Unused argument ( by = ...) when fitting gam model, and smoothing seperately for a factor

I am still a beginnner in R. For a project I am trying to fit a gam model on a simple dataset with a timeset and year. I am doing it in R and I keep getting an error message that claims an argument is unused, even though I specify it in the code.
It concerns a dataset which includes a categorical variable of "Year", with only two levels. 2020 and 2022. I want to investigate if there is a peak in the hourly rate of visitors ("H1") in a nature reserve. For each observation period the average time was taken, which is the predictor variable used here ("T"). I want to use a Gam model for this, and have the smoothing applied differently for the two years.
The following is the line of code that I tried to use
`gam1 <- gam(H1~Year+s(T,by=Year),data = d)`
When I try to run this code, I get the following error message
`Error in s(T, by = Year) : unused argument (by = Year)`
I also tried simply getting rid of the "by" argument
`gam1 <- gam(H1~Year+s(T,Year),data = d)`
This allows me to run the code, but when trying to summon the output using summary(gam1), I get
Error in [<-(tmp, snames, 2, value = round(nldf, 1)) : subscript out of bounds
Since I feel like both errors are probably related to the same thing that I'm doing wrong, I decided to combine the question.
Did you load the {mgcv} package or the {gam} package? The latter doesn't have factor by smooths and as such the first error message is what I would expect if you did library("gam") and then tried to fit the model you showed.
To fit the model you showed, you should restart R and try in a clean session:
library("mgcv")
# load you data
# fit model
gam1 <- gam(H1 ~ Year + s(T, by = Year), data = d)
It could well be that you have both {gam} and {mgcv} loaded, in which case whichever you loaded last will be earlier on the function search path. As both packages have functions gam() and s(), R might just be finding the wrong versions (masking), so you might also try
gam1 <- mgcv::gam(H1 ~ Year + mgcv::s(T, by = Year), data = d)
But you would be better off only loading {mgcv} if you wan factor by smooths.
#Gavin Simpson
I did have both loaded, and I tried just using mgcv as you suggested. However, then I get the following error.
Error in names(dat) <- object$term :
'names' attribute [1] must be the same length as the vector [0]
I am assuming this is simply because it's not actually trying to use the "gam" function, but rather it attempts to name something gam1. So I would assume I actually need the package of 'gam' before I could do this.
The second line of code also doesn't work. I get the following error
Error in model.frame.default(formula = H1 ~ Year + mgcv::s(T, by = Year), :
invalid type (list) for variable 'mgcv::s(T, by = Year)'
This happens no matter the order I download the two packages in. And if I don't download 'gam', I get the error as described above.

Global / Line Discount for Sale/Purchase/Account

[Odoo 14 Community Edition]
I need to customize Global and Line Discounts (amount & percentage) into Sale / Purchase / Account.
I have done the Sale and Purchase parts. It is just adding fields and a few logics here and there and send the data to Account (account.move) by prepare_invoice methods.
Now here's the issue I am facing -- The Account. I am having a tremendous confusion of where I should modify. After I tried to understand and tracked the flow of the standard invoicing/billing, I am at lost. There are too many functions/variables for me, who do not understand accounting, to try to get the whole idea out of it.
I did add the discount fields that I need. However, the standard calculation of price / taxes / credit / debit are messed up when I try to inherit some methods that I think I should modify. I ended up having incorrect taxes, unbalanced credit/debit, and incorrect total amount.
I tried editing here and there (by inheriting of course. I can still rollback everything I did).
The point is that I need precise suggestions and/or directions of what functions/methods I should inherit just enough to make discount possible. I have 2 Line Discount fields (amount and percent) and 2 Global Discount (also amount and percent). The calculation between them is not the point of interest here. The only problem at this point is to integrate these fields (from SO, PO, and manually created) into the calculation of everything in Invoicing/Billing.
Here are the fields:
account.move
global_discount_amount = fields.Float(string='Global Discount Amount', compute=compute_global_discount_amount, store=True)
global_discount_percent = fields.Float(string='Global Discount Percent', compute=compute_global_discount_percent, store=True)
account.move.line
discount_line_amount = fields.Float(string='Disc. Line Amount', compute=compute_discount_line_amount, store=True)
discount_line_percent = fields.Float(string='Disc. Line %', compute=compute_discount_line_percent, store=True)
Right now, I am messing with some methods such as: (a few examples)
account.move
_recompute_tax_lines
account.move.line
create
_get_fields_onchange_balance_model
_get_price_total_and_subtotal_model
_onchange_price_subtotal
Most of the modifications are written by copying the whole method from standard into my new model (inherit that standard model) and edit some codes here -- Override the standard code from my understanding.
Function computation/execution either depends on other fields value change or compute every time form/listview load.
Check in your case what is depends on the function compute_global_discount_amount and compute_global_discount_percentage
For better developing/troubleshooting, remove any #depends() fields declaration on the functions. Additionally, remove the store=True attribute temporarily. It will help you to narrow down the issue. And make sure you get the correct numbers.
Once you get it, add back fields depending.
Here is a sample example of a method (Odoo 14 CE) override which will be executed during compute amount.
#api.depends(
'line_ids.matched_debit_ids.debit_move_id.move_id.payment_id.is_matched',
'line_ids.matched_debit_ids.debit_move_id.move_id.line_ids.amount_residual',
'line_ids.matched_debit_ids.debit_move_id.move_id.line_ids.amount_residual_currency',
'line_ids.matched_credit_ids.credit_move_id.move_id.payment_id.is_matched',
'line_ids.matched_credit_ids.credit_move_id.move_id.line_ids.amount_residual',
'line_ids.matched_credit_ids.credit_move_id.move_id.line_ids.amount_residual_currency',
'line_ids.debit',
'line_ids.credit',
'line_ids.currency_id',
'line_ids.amount_currency',
'line_ids.amount_residual',
'line_ids.amount_residual_currency',
'line_ids.payment_id.state',
'line_ids.full_reconcile_id')
def _compute_amount(self):
super()._compute_amount()
for record in self:
record.compute_global_discount_amount()
record.compute_global_discount_percent()
def compute_global_discount_amount(self):
for record in self:
# Execute your logic for compute global_discount_amount
record.global_discount_amount = $$$$
have a look at apply_discount function in an inherited class of sale.order
def apply_discount(self, cr, uid, ids, discount_rate):
cur_obj = self.pool.get('res.currency')
res = {}
line_obj = self.pool.get('sale.order.line')
for order in self.browse(cr, uid, ids, context=None):
for line in order.order_line:
line_obj.write(cr, uid, [line.id], {'discount': discount_rate}, context=None)
return res
A new column was added to the new inherited subclass of sale order
'discount_rate' : fields.float('Discount rate'),
Then in the sale order view (an inherited one) placed the new field discount on the sale.order.view and fired an event on the on_change of the value passing the self value of the field to the on_change event
In this way you can apply discount sequentially to the rows of the order without altering the normal process.
Firstful, please pardon my English. Then let's get into the core, I guess that this is exactly the task that I was assigned. Luckily that I was not alone, I was guided by my so-called senior which showed me the way in order to achieve the Global Discount for Invoice and Bill.
By looking at your methods listing, you were already on the right path!
So now, let me help you further...as much as I can
As in my case, I didn't put any new field regarding the Global Discount in Account Move Line model, even though in Sale Order Line and Purchase Order Line Global Discount fields do exist.
All and all, here are the methods that need to be customized:
_onchange_invoice_line_ids
_compute_amount
_recompute_payment_terms_lines
_recompute_tax_lines
I heavily modified the 3rd and 4th methods. However, I think that I still have some bugs, don't hesitate to tell me.

New to Python and Pandas, Looking for help aggregating observations

I am relatively new to using Python and Pandas, and was looking for help with this line of code:
`Football.ydstogo[Football.ydstogo>='11']&[Football.ydstogo<='19']= '10-plus`'
I am working with data from the NFL, and trying to build a model to predict when a team will pass, or when a team will run the ball. One of my variables (ydstogo) measures the distance for the team, with the ball, to get a first down. I am trying to group together the observations after 10 yards for ease of visualization.
When I tried running the code above, the error in my output is "can't assign to operator". I've used this code before to change gender observations to dummy variables, so I'm confused why it is not working here.
As I understand, you want to find elements with (string)
value between '11' and '19' and set a new string there.
So probably your should change your code to:
Football.ydstogo[(Football.ydstogo >= '11') & (Football.ydstogo <= '19')] = '10-plus'
Alternative:
Football.ydstogo[Football.ydstogo.between('11', '19')] = '10-plus'

OpenNLP Named Entity Recogniser (NER) not recognising money

I am running a DKPRO UIMA pipeline with the OpenNLP Named Entity Recogniser running the following models: money, date, location, person. All of them work except money. Monetary items get identified but classified as dates. Here is an extract of my pipeline.
createEngineDescription(OpenNlpSegmenter.class),
createEngineDescription(OpenNlpPosTagger.class),
createEngineDescription(OpenNlpNamedEntityRecognizer.class,
OpenNlpNamedEntityRecognizer.PARAM_VARIANT, "money"),
createEngineDescription(OpenNlpNamedEntityRecognizer.class,
OpenNlpNamedEntityRecognizer.PARAM_VARIANT, "date"),
createEngineDescription(OpenNlpNamedEntityRecognizer.class,
OpenNlpNamedEntityRecognizer.PARAM_VARIANT, "location"),
createEngineDescription(OpenNlpNamedEntityRecognizer.class,
OpenNlpNamedEntityRecognizer.PARAM_VARIANT, "person"),
My gradle imports are
compile 'de.tudarmstadt.ukp.dkpro.core:de.tudarmstadt.ukp.dkpro.core.opennlp-model-ner-en-date:20100907.0'
compile 'de.tudarmstadt.ukp.dkpro.core:de.tudarmstadt.ukp.dkpro.core.opennlp-model-ner-en-location:20100907.0'
compile 'de.tudarmstadt.ukp.dkpro.core:de.tudarmstadt.ukp.dkpro.core.opennlp-model-ner-en-money:20100907.0'
compile 'de.tudarmstadt.ukp.dkpro.core:de.tudarmstadt.ukp.dkpro.core.opennlp-model-ner-en-person:20130624.1'
After experimenting with different text it became evident that the pipeline works but the 'money' model seems to only recognise $ value as money. Maybe it was only trained in one currency because it doesn't seem to recognise others. I tried EUR, €, and £. I will have to train my own model or create my own MoneyEntityRecogniser.

How to access data NOAA data through GRADS?

I'm trying to get some DAP data from noaa, but can't figure out how to pass variables to it. I've looked and looked and haven't found how to just poke around at it with my browser. The data is located at http://nomads.ncep.noaa.gov:9090/dods/ruc/ruc20110725/ruc_f17.info (which may become outdated some time after this post sits around.)
I want to access the ugrd10m variable with the variables time, latitude, and longitude. Any ideas what url is needed to do this?
According to their documentation, it sounds like you want to point your browser at a URL like:
http://nomads.ncep.noaa.gov:9090/dods/ruc/ruc20110914/ruc_f17.ascii?ugrd10m[0:1][0:1][0:1]
That will return a table of the ugrd10m values for the first two time/lat/lon points:
ugrd10m, [2][2][2]
[0][0], 9.999E20, 9.999E20
[0][1], 9.999E20, 9.999E20
[1][0], 9.999E20, 9.999E20
[1][1], 9.999E20, 9.999E20
time, [2]
734395.0, 734395.0416666666
lat, [2]
16.281, 16.46570909091
lon, [2]
-139.856603, -139.66417731424
The number of time/lat/lon points is given under the long description of ugrd10m at the dataset info address:
http://nomads.ncep.noaa.gov:9090/dods/ruc/ruc20110914/ruc_f17.info
time: Array of 64 bit Reals [time = 0..18]
means that there are 19 different time values, at indexes 0 to 18. In this case, the complete dataset can be retrieved by setting all the ranges to the max values:
http://nomads.ncep.noaa.gov:9090/dods/ruc/ruc20110914/ruc_f17.ascii?ugrd10m[0:18][0:226][0:427]
According to this reference, you can access data with this URL:
http://nomads.ncep.noaa.gov:9090/dods/ruc/ruc20110914/ruc_00z.asc?ugrd10m&time=19&time=227&time=428
However, I can't confirm the data's validity.