Palantir Foundry Metric Widget - how to add reactive filter - widget

How do I create a Metric Widget that counts a field but I want it limited based on a filter I've created. In other words my filter widget should change how the numbers of my metric report.

I'm making a few assumptions from your question, namely that you're referring to a "Metrics Widget" within the context of a Workshop application.
Metric widgets are display-only, so they're going to show whatever the value of accompanying Variable (numeric, string, date, or timestamp).
Filters operate on Object Set variables, so to have a metric widget respond to a Filter, you'll need something like:
[o] Starting Object Set (Object Set Variable) -> [f] Filter List Output (Filter Variable) -> [o] Filtered Object Set (Object Set Variable with Filter Variable applied) -> [n] Numeric Metric Calculation (Object Set Aggregation calculation)
With this setup, changing the values in the Filter List widget will update the [o] Filtered Object Set variable, which will in turn update the numeric variable value and then the Metric Widget display will update.

Related

Filters Multiple values directly on report

I wanted to instead of defining the parameter in the query but use the filter to work as parameters.
I have configured SSRS filter expression like
The parameter is called "Locations" and i am allowing multiple values
From the datasets: The field is called Location
Filter from the dataset
Expression:[LOCATION]
Operator: IN (i tried Like)
Value =Parameters!Location.Value(0)
When i run, it works when i pick one item from my drop down option. But when i pick more than 1 location i get values of the first value picked from the drop down only. It doesn't recognize the multiple choice.
You have enabled the multiple parameter, so you could use expression like below to see whether it works or not(it will recognize all parameters)
Expression:[LOCATION]
Operator: IN
Value =Parameters!Location.Value
Zoe

Passing parameter values

I have two parameters that give a date From and To.
I have two datasets that have the dates in the same format, but use two different dimensions. They both provide, Calendar Year, Calendar Month and Period.
I am trying to pass the value of the two parameters to two hidden parameters for the second dataset. I am not getting the expected data.
For example, I am passing 2017 and 2018 as From and To, but when this is passed to the hidden parameters, I am getting back the value for previous years as well.
Can someone post how they would pass a parameter value to a hidden parameter as I am clearly doing it wrong.
When setting up the hidden parameters, I am choosing to get default and available values from the visible parameters that appear in the dataset drop down list. Value field is ParameterValue. Label field is ParameterCaptionIndented but I am unsure what this is actually doing.
Following suggestion, have tried this
value will not update when parameters are changed
If both datasets are to use the same parameter values, there is no need to create two sets of parameters and awkwardly try to pass the value from one parameter to another.
If the parameters of your second dataset have different names, no problem, the Dataset Properties window contains a Parameters page that allows you to map the dataset parameters to your existing parameters, so you can re-use the visible parameters created for the first dataset and remove the other 2 parameters that were probably created automatically.

Populate a parameter dropdown based off another parameter

I am trying to populate a dropdown based off another dropdown parameter. I have 5 parameters, but the first 3 populate the 4th in the report. So the 4th and 5th parameter are what the user uses to populate a report. So the 4th parameter (meetings) has a meetings dataset and the 5th parameter is meetingType with a dataset of meetingType. So when the user selects a meeting, then the meetingType gets populated by that selection. Currently both dropdowns produce all results, which I don't want. I just want all results for meetings and then the meetingType gets populated by meeting.
The table it produces once the report is ran doesn't use those properties and there isn't a place to query anything. I can only use available values from each dataset and not use available values based on the selection of the 4th parameter.
I'm not really clear. do you need a parameter or do you just want to have the meeting type available as a value in your report output?
Fairly straightforward. You have two datasets, one for each parameter. You need to filter the second dataset based on the first parameter.
For example, I often create reports that ask for a range of values, let's say programs. Once the user has entered the beginning value, the ending value must be greater than or equal to the beginning value. So, on the ending value dataset I create a filter. In this case, the filter says that the field code (which is my program) must be between the starting parameter and the maximum value allowed:
You can make your filter as complex as needed - referring to the other parameter with a formula
You can also do this via separate datasets for each parameter.
Lets say you have two parameters #param1 and #param2
you want the values on #param2 to change based on #param1 selection.
You will have your main dataset (main_dataset) with a where clause something like this
where sometable.somecolumn = #param1
and sometable.someothercolumn = #param2
Now you create a dataset (param1_dataset) for #param1 which brings back all the values you require for this parameter
Now create another dataset (param2_dataset) form #param2 and add a where clause to it which restricts the returned list.. something like this..
where sometable.somecolumn = #param1
Now on your report parameters.. set the Available Values for each parameter (report parameter properties) to "Get Values from a query" and select the appropriate dataset and the value field and label field (returned by the dataset) for each parameter.
Now when you run your report, your parameter selection 2 should change based on what you selected for parameter selection 1

How to use IsLeaf in mondrian mdx formula?

Trying to recreate this formula in Pentaho Mondrian Cube.
iif(ISLEAF([Time].[Month].CurrentMember)),[Measures].m1,0)
This formula is being used in SSAS cube already. Need to recreate similar formula in Pentaho Mondrian Cube.
Can IsLeaf be used in mondrian or is there any alternative for this?
Something like the following should work at any arbitrary level within the default hierarchy.
It will return [Mesures].m1 for the last year, which (has non-empty m1 measure and satisfies your filter conditions) in case you select [Time].[Year] members.
Or it will return the measure for the last month of the last year, which has non-empty m1 measure in case you select [Time].[Month] members.
Though I don't think it will work if you mix members for different levels (e.g. WITH SET time_members AS {[Time].[2017], [Time].[2017].[1]. [Time].[2017].[1].[31]})
If you don't need such a generic approach, then this solution may be simplified and the measure calculation speed may be improved.
Warning: the query may cause 100% CPU utilization (or may not, I am not sure), thus making your server unresponsive. So, choose your testing environment carefully.
Disclaimer: I don't have mondrian to test at the moment, so the following example is very likely to have errors.
Iif(
// Check if current [Time] member is the last member:
[Time].CurrentMember
IS
// Take the 0th member from the end of the set (AFAIK, mondrian sets are guaranteed to be ordered):
Tail(
// AFAIK, Level.Members returns the full set of members, disregarding query filters.
// So I use Filter function to filter members, which don't exist in context of current cell.
// It should leave only members, which (are related to current cell and satisfy filter conditions of the query).
Filter(
[Time].CurrentMember.Level.members
// If your measure is nullable, then you might want to use count measure in this condition instead of m1:
, NOT IsEmpty([Measures].m1)
)
// Number of members to get by the Tail() function:
, 1
// Return the only member of the set as a Member (not as a Set):
).Item(0)
// return if true
, [Measures].m1
// else:
, 0
)
Some points that may be problematic and need to be tested:
How the measure is calculated if the last [Time] member has empty m1
measure (if this is a valid case for your measure)
How the measure is calculated at different levels of [Time]
hierarchy.
How the measure is calculated if you don't use [Time] dimension in
report explicitly.
How the measure is calculated if you use [Time] dimension on slicer
axis only (in WHERE condition)
How the measure is calculated if you use restricted set of [Time]
members, e.g. explicitly enumerating members in set literal (e.g.
{[Time].[2006].[01], [Time].[2006].[02]}) or via using Filter()
function on the dimension.
How the measure is calculated if you use fiters on other
dimensions/measures.
How the measure is calculated at calculated members of [Time]
dimension (including totals and sub-totals generated by Analyzer).
How the measure is calculated if you select members from different
levels on the same axis.

How to loop rows of dataset in Reporting services rdl custom code

How can I loop through the rows of a dataset in the custom code?
I have a report containing a dataset. I pass the dataset as a parameter to the custom code function. But what then? Where is a reference about the available members etc.?
Here is my dummy sample code so far:
Public Function ShowParameterValues(ByVal ds as DataSet) as object()
Dim codes() As Object
Array.Resize(codes,dc.???.Count)
codes(0)=ds??(field???)(row??)
return codes
End Function
Please note: this will be a very simple script (if it'll work), so I don't want to go into custom assemblies etc.
I think you got your answer at:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/a7d59224-0ee5-491e-883b-2e5fcb3edeab/iterate-through-rows-of-dataset-in-reports-custom-code?forum=sqlreportingservices
There were two important pieces of information I was able to grasp from the above link:
First, A dataset in Reporting Services is not the same type of object as an ADO.Net dataset. A report dataset is an internal object managed by the SSRS runtime (it's actually derived from a DataReader object) and not an XML structure containing datatables, etc. and cannot be passed into the report's custom code.
Second, There was a solution posted as to how one can Iterate through rows of dataset in report's custom code by "transforming" the data set into a multivalued parameter (or if several fields are needed, transforming it in multiple multivalued parameters):
The multivalued Report Parameter must have the following characteristics:
Hidden = True, Allow Multiple Values = True
Available Values tab: Choose the desired dataset. Select the searchable id as Value id, and the field you want to expose as Label Field.
Default Values Tab: Get Values from a Query.
Choose the same Dataset as choosen in the available Values Tab.
Value Field the same you choose for value id.
Set the parameter to never refresh (or it will be loading the data from each iteraction of another parameter).
Now, the idea is make this Parameter "searchable". From this point you exposed the Dataset as an array in the Multi valued Parameter.
Now in a custom code insert the following code:
function GetDataSetLabelFromValue( id as integer) as String
dim i as integer
i = 0
for i = 1 to Report.Parameters!YourParameter.Count()
if Report.Parameters!YourParameter.Value(i) = id then
GetDataSetLabelFromValue = Report.YourParameter!ReportParameter1.Label(i)
Exit For
End if
next i
End Function
Were you able to do what you wanted?