How to creat a chart from a value in PowerBI - charts

When I try to create a chart from a value (Datatype : Double) PowerBI keeps considering the COUNT(myvalue) and not the value itself.
Same issue when i try to add value_from_field_A to value_from_field_B it adds COUNT(value_from_field_A) + COUNT(value_from_field_B) which gives 2 (1+1...).
Doesn't it seem natural to take the value itself instead of the count ??
What should I do?
Thanks in advance !

Related

Sum columns of a dataset

I'm working in PySpark and I have a dataset like this :
I want to create a new df like this with the corresponding sums :
So I tried this code :
df = df.withColumnRenamed("month_actual_january", "monthjanuary")
fin=df.groupBy(["column1","column2"]).sum()
The problem is that I get the following error :
Attribute sum(column3) contains an invalid character among ,;{}()\n\t=. Please use an alias to rename it
Do you know how to fix this error ? Thanks !
Lets try use least squares to pass a wild card alias as follows
df.groupBy(["column1","column2"]).agg(*[sum(x).alias(f"sum_{x}") for x in df.drop("column1","column2").columns]).show()

Cast constant value from series

I'm completely new to this forum and tradingview/pinescript. I am trying to script an indicator, and part of the script requires assigning a constant value to a variable from a series.
From a moving average of the volume (50day average volume), I want to set the constant variable 'reference_Vol' to the value of the moving average from yesterday's price bar only and no other days in the past before yesterday, but the variable gets overwritten after each older bar as 'volume' is a series, so effectively the variable is not constant but dynamically changes over the history of the price bars.
SMA_50d = sma(volume,50)
reference_Vol =SMA_50d[1]
I have tried setting the value as a literal (literal int(x)), messing around with the valuewhen() function, but I have just not enough scripting experience of what I am doing. I have a feeling there is an easy solution to this, and I could really use some help.
Thanks a bunch!
This should do what you intended
//#version=5
indicator("My Script", overlay=false)
var float reference_Vol = na
new_day = ta.change(dayofmonth)
SMA_50d = ta.sma(volume,50)
if new_day
reference_Vol := SMA_50d[1]
plot(reference_Vol, style=plot.style_linebr, color=new_day ? na : color.blue)

Incorrect syntax when attempting to use two values in order to create a parameter in SSRS

I'm attempting to create a parameter for when jodrtg.fdescnum <> inmastx.fbin1. I want to be able to use this in a dropdown list selection for my report. I have tried a number of combinations but keep getting syntax errors near the <or =.I'd be appreciative if anyone can point me in the right direction. I've never tried using two fields to create a single parameter before.
This what I've been attempting to get as my final result.
jodrtg.fdescnum <> inmastx.fbin1 = #MoldPress
I learned that you can only use one operator at a time but they can be combined using bool logic.
WHERE (jodrtg.fdescnum <> inmastx.fbin1
OR #ParameterName = 'Unfiltered')
AND (jodrtg.fdescnum <> inmastx.fbin1) OR #MoldPress = 0

How to display data required using a database value

I am new to crystal reports and I am trying to get round formulations.
I am trying to display certain data in a report by using a particular value from the database. All the data i need to display is within the value '1' of the database.
I have tried with an if statement, which seems to work but displays true and false instead of the actual data. Can anyone help me with this please?
if {database.column} = 1 then
true
else
false
This is where I have got too, just need a little guidance please
Try using the code below:
if {database.column} = 1 then
database.column
else
0

Check if Matlab struct, dynamic Field Value is empty

I have a struct x, with dynamic Fields, respectively dynamic Field names. But basically, only the first Field is relevant for me.
So I want to check if the Value of the first Field is empty, speak a 1x1cell or a 0x1cell..
or
I'm experimenting e.g. with:
isempty(fieldnames(x))
isempty(x(1))
if isempty(x(1))
msgbox('empty')
else
msgbox('result')
end
but got to no solution. Does anybody have a clue?
Speak, check if the Value of the first Field of the struct is empty or not..
If only the first field is relevant to you, then you can proceed as follows :
Get the fieldnames list of your struct
names=fieldnames(x);
Get the size of the first field
SizeOfFirstField=size(x.(names{1}));
Then you can just check if the first value in SizeOfFirstField is 0 or 1 in your if condition :
if SizeOfFirstField(1)==0
msgbox('empty')
else
msgbox('result')
end
Maybe you can also try this shorter form:
isempty(fieldnames(x))
where x is your struct variable.