Insight Visual Custom Narratives

Hi
I’m using Insight Visual to display overall score in % but this % display should be based on certain if then logic. I have two columns Avg(score) and Dept and based on certain logic i want display Avg(Score) %
Example:
If Dept is -5 then XYZ else Avg(Score) %
if Dept Is -1 then ABC else Avg(Score) %

How to achieve this in Insight visual using custom narratives

Thanks,
BS

Hello @SantoshB !

I found this section of the documentation very helpful for working on insight narratives:

Hope this helps!

2 Likes

Hello @SantoshB, to add on to the documentation that @duncan linked, insights contain If statement functionality, but unfortunately do not have if, if else, and else, so you will need to have 2 different if statements to check for each case you mentioned above.

1 Like

Thanks for your reply. Is it possible to provide some sort of sample code?

Hello @SantoshB, I would recommend you try building this out based on the information provided by the documentation. You will likely need to create 2 different calculations in the narrative after adding the required fields to your field wells. Once you have tried to build this out and run into errors based on your calculation, you can show us the custom narrative function and we can guide you further.

I would be able to assist you a lot more if I have a function I can debug rather than building a complex aggregation from scratch based on data I do not know. You are also welcome to set this up in QuickSight Arena, where we could view the custom narrative you created and help guide you from there. Thank you!

I’ll drop some screenshots of the process to add multiple fields into your insight field well and create a new computation within the insight based on your fields. Once you have the 2 computations in your narrative editor, you should be able to begin building out the 2 if statements.

Add fields into the visual field wells
InsightFieldWells

Click + Add Computation
NarrativeAddComputation

Select the computation you want
NarrativeSelectComputation

Select the fields you want to use

Once both are added, you can play around with the IF statements.

Thanks. One more related qq to this. I’m trying to add more if then blocks within same block. How could I do it? Its not allowing me to add more then 2 inline Ifs

Hello @SantoshB, I believe 2 inline ifs within a single IF block is the limitation. Something you can do as well would be to create more insight visuals and allow each to check for 2 different IF statements. Then if you set your analysis sheet to a free form layout, you can utilize Rules in the edit visual section to display a specific visual depending on a parameter value. That would allow you to seamlessly transition between a few different visuals without overcomplicating the functionality of an individual narrative. I’ll link some documentation on the conditional Rules.

Thanks for your help. I can make it work now but have different issue.
How to handle custom narratives in case of no values for select control? Example: In control panel if I select one values and if that values doesn’t exist in custom narratives, i would like to display ABC

1 Like

Hello @SantoshB, as you have probably noticed at this point, this is where insights can be very difficult to customize. I would recommend trying to simplify what you are wanting to display if possible. Alternatively, there is a possibility if you check whether the value is null and then return an alternate value from one of the calculations you entered. That would require utilizing another IF statement within the narrative but it should be possible!