How to pass contant string value for a column in SUMMARIZECOLUMN - dax

I want to pass a constant string value i.e. Not Applicable for one of the column values that will be used in SUMMARIZECOLUMNS function. But I am not find any format in how to do the same.

SUMMARIZECOLUMNS( table_name[column_name], "Custom_Column_Name", "Not Applicable")

Related

Power Automate - Subtract two integer variables

I am trying to subtract two integer values as such:
But I get this error:
Unable to process template language expressions in action 'Negative_Index_of_Snabel-a' inputs at line '0' and column '0': 'The template language function 'sub' expects its first parameter to be an integer or a decimal number. The provided value is of type 'String'. Please see https://aka.ms/logicexpressions#sub for usage details.'.
I know that my variables in the sub() function is in quotes. But I cannot save it otherwise.
You're passing in literal string values, you need to specify that the values you want to evaluate are variables, like thus ...
sub(variables('VarMailInt'),variables('VarSnabelaIndex'))

Change value psql where value between, as string

I have a query that must set a value if the number is between 2 values, but the output is not ok, I think because that column is a string. Any way to do it even it's string?
(In output I have value as , 5 witch is not ok).
All the values that are incorrect are Integer.
SET lkp_age_category_id = 7
WHERE
age BETWEEN '26' and '35.99';
I guess, only working on the SQL side, you could cast the values right into the query, e.g.:
SET lkp_age_category_id = 7
WHERE age BETWEEN '26'::float AND '35.99'::float;
Also check this answer https://stackoverflow.com/a/13809603/917617.

In TI-BASIC, how do I display the Variable Name given only the variable?

I'm creating a function that displays a lot of variables with the format Variable + Variable Name.
Define LibPub out(list)=
Func
Local X
for x,1,dim(list)
list[x]->name // How can I get the variable name here?
Disp name+list[x]
EndFor
Return 1
EndFunc
Given a list value, there is no way to find its name.
Consider this example:
a:={1,2,3,4}
b:=a ; this stores {1,2,3,4} in b
out(b)
Line 1: First the value {1,2,3,4} is created. Then an variable with name a is created and its value is set to {1,2,3,4}.
Line 2: The expression a is evaluated; the result is {1,2,3,4}. A new variable with the name b is created and its value is set to `{1,2,3,4}.
Line 3: The expression b is evaluated. The variable reference looks up what value is stored in b. The result is {1,2,3,4}. This value is then passed to the function out.
The function out receives the value {1,2,3,4}. Given the value, there is no way of knowing whether the value happened to be stored in a variable. Here the value is stored in both a and b.
However we can also look at out({1,1,1,1}+{0,2,3,4}).
The system will evaluate {1,1,1,1}+{0,2,3,4} and get {1,2,3,4}. Then out is called. The value out received the result of an expression, but an equivalent value happens to be stored in a and b. This means that the values doesn't have a name.
In general: Variables have a name and a value. Values don't have names.
If you need to print a name, then look into strings.
This will be memory intensive, but you could keep a string of variable names, and separate each name by some number of characters and get a substring based on the index of the variable in the list that you want to get. For instance, say you want to access index zero, then you take a substring starting at (index of variable * length of variable name, indexofvariable *length + length+1).
The string will be like this: say you had the variables foo, bas, random, impetus
the string will be stored like so: "foo bas random impetus "

grid filter in foxpro

I have a grid on a form that displays some columns from a dbf table and a textbox.
I want to search the value displayed in the textbox over all columns from a dbf table. Some fields are numeric and other are character
If I want to find a number, should search all record that contain that number in all columns, no matter the column type.
If I want to search a substring should give me all record that contain that substring.
SET FILTER TO ALLTRIM(ThisForm.Text1.Value) $Content or ALLTRIM(val(ThisForm.Text1.Value)) $registrationNumber or ALLTRIM(ThisForm.Text1.Value) $holderNo
Your approach with the "$" wildcard "contains" approach appears to be ok. However, your attempt via allt( val( )) would fail as you cant trim a numeric value, it would have to be pre-converted to a string.
Now, that said, you could shorten your query by just doing a $ against a concatenation of ALL columns something like (assuming your registration number is a numeric field)...
set filter to ALLTRIM(ThisForm.Text1.Value) ;
$ ( Content +"," +str(registrationNumber) +," + holderNo )
if you have dates or date/time fields you could do DTOC( dateField ) or TTOC( dateTimeField). So, by building a single string of all values, you dont have to explicitly repeat the OR condition repeatedly.
You could do something like:
select curGrid
scan
lcRow = transform(field1) + transform(field2) ... + transform(lastfield)
if lcSearchValue $ lcRow
DoWhatever()
endif
endscan
This leverages the fact that transform() will give a string representation of any data type.

NULL when casting string values to decimal in Hive

I'm using Hive 0.13 and I have in a STRING column of my table values like 1.250,99
I want to cast these values into decimal, so I must replace "." by "" and "," by "." The result would be 1250.99
This is my hql sentence:
cast(regexp_replace(regexp_replace(price, '\\.',''), ',','.') as decimal(18,6))
But it returns NULL, I suppose because the conversion does not succeed. What is the problem?
If I don't do the conversion, it returns the expected string.
UPDATE
My problem was that there were white spaces in the column, so it could not convert it into decimal value. I have used trim function before doing the conversion.
Try this:
select cast(regexp_replace(regexp_replace('1.234,56','\\.',''),'\,','\.') as decimal(10,2));

Resources