Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

Switching between alternative measures using API

Hi,

I would need to change the active measure on a chart based on a combo box selection in my mashup. The measures are defined in the measures section. I thought the easiest way to do this would be to assign all the measures as alternatives dimensions and set the active one using the mashup API. But I cannot find the method to set the active alternative measure in the documentation.

Is there an API method to set the active measure in a chart? Otherwise, can we change programmatically the measure? I know I can set variables, but I cannot call a measure using a variable as far as I know...

Thank you!

7 Replies
Highlighted
Partner
Partner

Re: Switching between alternative measures using API

Actually, I think the alternative dimension idea won't work... I need KPIs to change also, and they don't support alternative dimensions...

Highlighted
Not applicable

Re: Switching between alternative measures using API

Hi,

You can switch or change measures and dimensions with the Qlik Sense .NET SDK ‒ Qlik Sense, You can find more examples on Qlik Branch.

Best regards

Lars-Göran Book

Highlighted

Re: Switching between alternative measures using API

Hi Maxime,

You could use a variable instead and use the variable extension on Qlik Branch. That way you could also change a number of charts, KPIs etc at the same time, with just one click.

Hope this helps

Erik

Highlighted
Partner
Partner

Re: Switching between alternative measures using API

Hi,

I figured out how to change the formulas or part of them using variables, but is it possible to point to a predefined measure?

Thanks!

Highlighted
Creator
Creator

Re: Switching between alternative measures using API

I'm currently searching for similar idea. Did you find a solution using the API?

Highlighted
Partner
Partner

Re: Switching between alternative measures using API

Hi Hans,

I did not find how to point to predefined measures, but we are now using variables for each measure, so it would be easy to switch between them.

For example:

LET vL.ClientCost = SUM([Client Costs Field])

LET vL.ClientRevenue = SUM([Client Revenues Field])


LET vL.SwappableMetric = $(vL.ClientCost)


And in your metrics, you could simply use the variable value.

For example, My [Client Costs] metric would be $(vL.ClientCost).

Hope this helps!

Highlighted
Creator
Creator

Re: Switching between alternative measures using API

Hi Maxime

Thank you for the response! I decided to go another route and generate the Qlik graphs "on the fly" in JavaScript, allowing dynamic switch between dimensions/measures/graph type etc. throught the front-end.