cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create a filter for calculated measure in sac analytic application table

rijin_baby
Participant
0 Kudos
1,864

Hello,

I have created an analytic application and has a table as displayed below

Here "INPUT AB" is a calculated measure.

I need a filter or input control-like feature that will help me to hide all rows that have a NULL value for the column "INPUT AB".

Is there any code snippet that I could use and filter the table as I needed?

Thank you

View Entire Topic
JBARLOW
Contributor

A very quick answer before I go to the pub 🙂 --- so more a starting point

1. I created a calculated measure: GM that displays 100 if the Gross Margin is < 10million
IF(["BestRunJuice_SampleModel":Gross_Margin]<10000000 ,100 )
............................if greater than 10mil it will return blanks/nulls

2. Create a Measure based dimension and add it to the table rows - GMDIM
This is a dimension that uses the values from the calculated measure GM above

I have a table like this below
The button contains the code:

Table_1.getDataSource().setDimensionFilter("31785582-6112-4744-9948-322815672548","0");
When clicked the table is filtered to only show the GMDIM rows = 0

rijin_baby
Participant
0 Kudos

Hello jbarlowjb

Thank you for the suggestion. This is my table

The script worked for dimension

Table_5.getDataSource().setDimensionFilter("SUPPLIER.Supplier_Code","22***"); // working

But it didn't work for measures. I tried the following

// INPUT AB = 27159717-6203-4541-9708-130721771612
Table_5.getDataSource().setDimensionFilter("27159717-6203-4541-9708-130721771612","10");
Table_5.getDataSource().setDimensionFilter("27159717-6203-4541-9708-130721771612",{from:"0.05"});
Table_5.getDataSource().setDimensionFilter("27159717-6203-4541-9708-130721771612",{greater:"5"});
Table_5.getDataSource().setDimensionFilter("18570737-5431-4606-b288-840336402033",{greater:"5"}); //infla

Any suggestions

Thanks again 🙂

JBARLOW
Contributor
0 Kudos

Hi there,

From the above code sample , it looks like you're trying to apply multiple dimension filters on the same table?

i.e. filter on multiple values from the same dimension "27159717-6203-4541-9708-130721771612"

The first line of code should work
Table_5.getDataSource().setDimensionFilter("27159717-6203-4541-9708-130721771612","10");
Assuming you enter ctrl+space after the dimension name to open the member selector.

Is 27159717-6203-4541-9708-130721771612 definitely a measure Dimension?

rijin_baby
Participant
0 Kudos

jbarlowjbI use just a single code, the remaining are others that I tried

Table_5.getDataSource().setDimensionFilter("27159717-6203-4541-9708-130721771612","10");

also since this is a calculated measure I don't get the name with ctrl+space instead I use

var x = Table_5.getSelections();
console.log(x);

to get the id for measure

JBARLOW
Contributor
0 Kudos

I think the problem is that you're still trying to filter on a calculated measure.

I had to:

1. Create a calculated measure
2. Create a measure dimension based on the calculated measure created in step 1
3. Filter on the measure dimension

rijin_baby
Participant
0 Kudos

Thank you. It works