Narrative With Null Handling

Rule Name - Top.items[index].categoryValue.formattedValue has most rule hit in ${TimeRange} — Iam using this formula to display the top hits in a time frame using computation attached

. I want to ensure when no rule are hit the user is displayed a different message like no rule were hit for given time frame

Hello @deepa.singh

Thank you for your question.

Can you achieve this by creating the calculation as follows

  1. Your calculated field TopHits - (Top.items[index].categoryValue.formattedValue)
  2. Create a Calculated Field TopHitsMessage for the Custom Message - ifelse( isNull(TopHits), ‘No rules were hit for the given time frame’, concat('The top hit is ', TopHits))

By using the ifelse function in the calculated field, you ensure that a user-friendly message is displayed when there are no rule hits within the specified time frame. This way, your users will always have relevant information displayed in your Quick Sight analysis.

If you need more help with specific steps or have additional questions, feel free to reply!

1 Like

Can we customize the message in Narrative , Like insight message can we customize

Hi @deepa.singh ,

Yes, you can handle this using the If constructs available within narrative editor.
Move the whole top contributor content within an IF block that checks for itemCount > 0 and add another IF (inline or block) that checks itemCount=0 for the custom error message. See screen shot below. I’m marking this as solution to your question. Please let us know if you face further issues.

Regards,
Arun Santhosh
Pr Quick Sight SA

1 Like

Thank you arun sorry to reopen please help edit this narrative

Most welcome Deepa.

I’m not sure what additional help you are expecting and can’t really say anything from the screen shot you shared. If you are facing further issues after implementing the logic that was shared earlier, create a sample analysis in Arena and explain further.

Regards,
Arun Santhosh
Pr Quick Sight SA