Mixing lod and non-lod calculations - tableau-api

I have a data set that looks like this:
I want to use a parameter to select a value from Group and then compute Ratio which is Value divided by Value when Group == parameter. The image above is the desired output when the parameter equals D.
I thought that this would do the trick:
[Value]/{EXCLUDE [GROUP]: MAX(VALUE)}
But I just get nulls.
Thanks for your help!

LOD expressions dont work that way and they will always show as null values in the datasource page. Here is the Documentation. (Bullet point 2)
For your case, create the parameter as shown below. (You can use 'Paste from clipboard' as by default only values can be assigned by field and not 'Display As'.)
Now your calculation simply becomes
[Value]/[Selected_Group]

Related

Suppress section with condtion

I need to suppress a section in Crystal Reports when the Change column is less than the absolute value of $12,000 AND if the Group By is Customer
How can I implement something like this below?
if abs({change}) < 12000 and {group by} = "Customer" then TRUE
First off, you'll never need to write something like If XYZ then True because you get the same result from just XYZ. So that will simplify your code a bit.
You have the correct code for checking absolute value, so your issue probably lies with checking the Group By value. The Group By value is whatever you set it to be, but it's always set to an existing table object or formula. This would transform your formula into this:
(ABS({change}) < 12000) AND ({#groupByFormula} = "Customer")

How to use Metric value in Alias?

I created a new Graph in Grafana that takes data from OpenTSDB.
The Alias field has the following value: Label $metric $tag_host.
when it is interpreted, it looks like this:
Label $metric myhost1
...
Label $metric myhostn
but I want to look like this:
Label xyz myhost1
...
Label xyz myhostn
where xyz is the value of the Metric field.
So, for a key (E.g.: host) in Tags, I can use $tag_<key> (E.g.: $tag_host) in Alias.
I want to achieve the same behavior for the hard-coded Metric value (E.g.: xyz), such that if someone wants to change the Metric value in the future from xyz to abc, the Alias should be updated automatically.
I tried to use:
$metric
$Metric
$tag_metric
but they didn't work.
Is it possible to use the Metric value in Alias without hard-coding in Alias (the hard-coding from Metric is enough)?
My solution: I included second tag (first one was id - $tag_id) into GROUP BY (tag(sql)) and then I used $tag_sql ($tag_key) variable to define alias for current series of data thus:
Highlighted fields are tags.
This might be a XY Problem.
If what you're trying to do is just to show the value in the Label, you don't need to create an alias. Just go to Legend and tick the appropriate option(s) (Min, Max, Avg, etc.). This will add a new column(s) near the Label with the appropriate value.
I'm using Grafana 4.4.3.

iReport sum of two measures

I'm having problem with JasperReports report by getting sum of two fields.
I have created so far variables that holds fields "TareWeight" variable that is casting values from double to float
new Float($F{EquipmentTareWeightKg})
"CargoWt" variable that is casting from string to float, etc...
Float.parseFloat($F{UfvFlexString03})+Float.parseFloat($F{UfvFlexString04})
So now I have two variables which I can manipulate with.
The problem starts when I wish to do a "recap" using crosstab. I have setup two groups that is done with wizard, and added another in crosstab. (please refer to the printscreen below)
And now, I have created under measures SumOf Tare that is using variable TareWt, and SumOfCargoWt that is using variable CargoWt.
I have tried to create another Measure SumOfGrossWt that would do a sum of variables TareWt + CargoWt but I have got some nonsense values.
I have tried to do another approach by creating variable GrossWt that would basically do exact the same thing as previous attempt
$V{Tare}+$V{CargoWt}
or use an variable: GrossWt
$V{Tare}+$V{CargoWt} or new Float($F{EquipmentTareWeightKg})+(Float.parseFloat($F{UfvFlexString03})+Float.parseFloat($F{UfvFlexString04}))
None of these actually worked: (Sum should be done by "Sum Of Tare"+ "Sum of CargoWt" = "Sum of GrossWt") plese refer to the second picture.
Here is a complete jrxml code/file:
jrxml file
save it as *.jrxml
Can please someone help me find a solution? how can I sum those two measure fields and get correct values?
Since CargoWt field had some null values in database, addition float value with null is equal to null, so the only value which was displayed on report are the one that had values for CargoWt, all others with null value were "ignored".

Visualization Tableau - Remove an option from a filter

This is the link of my visualization: My dashboard
In the tab "Cursos por ciclo", I would like to know how to remove the option "PTJE.TOTAL" from the filter "CURSO".
You can do this by creating a new calculated field.
Right click on CURSO and select "create calculated field" then use this formula:
IF left([CURSO], 4) <> "PTJE" THEN [CURSO] END
Basically, this means: if the value does not start with "PTJE" then include it.
Then use the new calculated field as a filter, you will see that it does not include the "PTJE. TOTAL" value (it has been replaced with nulls now). So when you apply a quick filter the "PTJE. TOTAL" value won't appear.
Note: Normally I'd use something simpler like:
IF [CURSO] <> "PTJE. TOTAL" THEN [CURSO] END
but that is not working with your data for some reason.
Also, you can read more about calculated fields in Tableau here:
http://onlinehelp.tableausoftware.com/v6.1/public/online/en-us/i181523.html

Mark mandatory fields on form, if not filled with valid value

if you create a new dataset, mandatory fields which are not set yet are marked with a wiggly red line.
it seems, that only string-values ( or several fields, but at least no integers ) are marked this way.
if integer-references are used ( 1-based ), the regarding fields are filled with 0 per default which causes the red line to disappear.
is there any way to leave those fields empty per default?
thanks for hints!
For integer and real fields you could set the ShowZero property to No (on the control or extended data type). Then zero values will appear with a red wave line.
For new base enums leave a blank zero enum value (by convention name it None).
Dynamics Ax does not have an "null" concept for fields. It uses some "zero" values for all data types - so you need to use some other NoYes field to express what you want if 0 is not empty