Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
varunreddy
Creator III
Creator III

Selecting one metric in Adhoc Reporting

Hi Guys,

I am trying to build an adhoc report and I succedded. In my scenario I have two metrics and I want user to select one metric at a time. Is there a way to do it.

We can do it with always one selected value, But I don't want to use that option.

Any other alternatives?

Thanks in advance.

Cheers!

1 Solution

Accepted Solutions
varunreddy
Creator III
Creator III
Author

Thanks for your reply Guys.

I got the solution.

GetSelectedCount(Detail_Measure)>=1 and (Concat(Detail_Measure, ',') like '*Count of IssuesSum of Materiality Amount*' or  Concat(Detail_Measure, ',') like '*Sum of Materiality Amount*')

Cheers!

Varun

View solution in original post

6 Replies
rubenmarin

Hi Varun, not sure of how works your solution but maybe one option can be using the conditional expression, creating different expressions and setting the conditional based is the value, this way you allow the user to choose more than one metric.

To limit to one selected metric at a time my preference is the 'Always one Value selected', why this option can't work for you?

Other options:

- Conditional calculation on the ad-hoc report with the expression: GetSelectedCount(MetricField)<>1

  And the message 'Select only one metric to show the report' or something like that

- Actions: In "Document properties --> Triggers" you can set actions when values are selected. There you can set the action that when values selected are more than one, the field selections goes empty, or if you want to complicate a bit you can set more than one action:

     1.check if selections are more than one, in that case select the previous value stored in a variable, if one is selected select the value.

     2. If there is one value selected assign the value selected to the variable (the value that returns when user selects more than one value)

varunreddy
Creator III
Creator III
Author

Hi Ruben,

Thanks for the response.

I have a scenario where, If I select a metric, it should take 2 default dimensions.

Metrics - Count of Issues and sum of materiality amount

For my scenario I am using - GetFieldSelections(Detail_Measure)='Sum of Materiality Amount'  .

This is working fine for Sum of materiality amount.

Now the issue is, If I select two metrics, the default dimensions should be populated. But it is not populating because of my expression.

Can you suggest me an expression, which displays default dimension if I select one metric(Sum of materiality amount) and Both the metrics

Peter_Cammaert
Partner - Champion III
Partner - Champion III

For the Default Dimensions that are shown if you select a specific metric (Sum of Materiality Amount) or the two available metrics, use a conditional show expression like this:

Match(GetFieldSelections(Detail_Measure), 'Sum of Materiality Amount')

Best,

Peter

varunreddy
Creator III
Creator III
Author

Hi Peter,

I am using this:

if(GetFieldSelections(Detail_Measure)='Sum of Materiality Amount' or (GetFieldSelections(Detail_Measure)='Sum of Materiality Amount' and GetFieldSelections(Detail_Measure)='Count of Issues'), 'Sum of Materiality Amount')  .

This is working fine. But I dont want to show two default dimension when I select Count of Issues.

Can you guide me?

Regards,

Varun

rubenmarin

Hi Varun, if you have both metrics selected, GetFieldSelections(Detail_Measure) will return something like 'Sum of Materiality Amount,Count of Issues' --> all thogether in the same string, so when you make the string comparison both are false.


Maybe trying with Index() or Substring():

if(Index(GetFieldSelections(Detail_Measure), 'Sum of Materiality Amount') or (Index(GetFieldSelections(Detail_Measure),'Sum of Materiality Amount') and Index(GetFieldSelections(Detail_Measure),'Count of Issues')), 'Sum of Materiality Amount')


This last can be resumed to:

if(Index(GetFieldSelections(Detail_Measure), 'Sum of Materiality Amount'), 'Sum of Materiality Amount')

varunreddy
Creator III
Creator III
Author

Thanks for your reply Guys.

I got the solution.

GetSelectedCount(Detail_Measure)>=1 and (Concat(Detail_Measure, ',') like '*Count of IssuesSum of Materiality Amount*' or  Concat(Detail_Measure, ',') like '*Sum of Materiality Amount*')

Cheers!

Varun