Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
RichOB
Post Partisan
Post Partisan

Need help creating narrative sentences where the text changes when the data updates

Hi, I saw a way ages ago for adding text to a report where the key data points change as the source data updates. I want to write the sentences below in my report using the tabled data underneath it. I need it to be more quarter specific than the information that the Smart Narrative.

 

- Total amount of Incidents grew in Q2 to Q3 by X%

- LOCATION had the highest amount of Incidents from Q2 to Q3 by X%

- INCIDENT TYPE increased from Q2 to Q3 by X% with LOCATION having the most at X%

- INCIDENT TYPE decreased from Q2 to Q3 in X by X%BY LOCATION having the biggest decrease by X%

 

Incident TypeLocationDateFinancial Quarter
Missing personGlasgow02/08/2024Q2
Missing personGlasgow02/08/2024Q2
Medical concernGlasgow01/11/2024Q3
Missing personGlasgow01/11/2024Q3
Missing personGlasgow01/11/2024Q3
Medical concernEdinburgh02/08/2024Q2
Medical concernEdinburgh02/08/2024Q2
Missing PersonEdinburgh02/08/2024Q2
Medical concernEdinburgh01/11/2024Q3
Medical concernEdinburgh01/11/2024Q3
AggressionManchester02/08/2024Q2
AggressionManchester02/08/2024Q2
AggressionManchester01/11/2024Q3
AggressionManchester01/11/2024Q3
Medical concernManchester01/11/2024Q3

 

Thanks for your help!

3 REPLIES 3
RichOB
Post Partisan
Post Partisan

Hi @FarhanJeelani  just checking in with this, the first step above you mention is making a table but I'm having trouble with the column count when you said:

  • Count the number of incidents for each combination.

What measure did you add to the new table to get that column count please?

FarhanJeelani
Super User
Super User

Hi @RichOB 

To generate the sentences dynamically based on the data provided, we can break this down into steps using DAX . Here's how to create those insights accurately:

Steps to Implement:

  1. Prepare a Pivot Table or Summarized Data Table

    • Group the data by Incident Type, Location, and Financial Quarter.
    • Count the number of incidents for each combination.

    Example:

    Incident Type Location Financial Quarter Count
    Missing PersonGlasgowQ22
    Missing PersonGlasgowQ33
    Medical ConcernGlasgowQ31
    Medical ConcernEdinburghQ22
    Medical ConcernEdinburghQ32
    AggressionManchesterQ22
    AggressionManchesterQ32
    Medical ConcernManchesterQ31

Key Measures:

  1. Total Growth in Incidents (Q2 to Q3):

    TotalGrowthIncidents = 
    VAR Q2Incidents = CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q2")
    VAR Q3Incidents = CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q3")
    RETURN
    DIVIDE(Q3Incidents - Q2Incidents, Q2Incidents, 0)

    Output: Calculate the % change from Q2 to Q3.

  1. Location with the Highest Growth in Incidents:

    LocationGrowth = 
    ADDCOLUMNS(
        SUMMARIZE('Table', 'Table'[Location]),
        "Growth", DIVIDE(
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q3") -
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q2"),
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q2"), 0
        )
    )
    RETURN TOPN(1, LocationGrowth, [Growth], DESC)

    Output: Location with the highest percentage growth.

  1. Incident Type with the Highest Increase:

    IncidentTypeGrowth = 
    ADDCOLUMNS(
        SUMMARIZE('Table', 'Table'[Incident Type]),
        "Growth", DIVIDE(
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q3") -
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q2"),
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q2"), 0
        )
    )
    RETURN TOPN(1, IncidentTypeGrowth, [Growth], DESC)

    Output: Incident type with the highest percentage growth and associated location.

  1. Incident Type with the Largest Decrease:

    IncidentTypeDecrease = 
    ADDCOLUMNS(
        SUMMARIZE('Table', 'Table'[Incident Type]),
        "Decrease", DIVIDE(
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q3") -
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q2"),
            CALCULATE(SUM('Table'[Count]), 'Table'[Financial Quarter] = "Q2"), 0
        )
    )
    RETURN TOPN(1, IncidentTypeDecrease, [Decrease], ASC)

    Output: Incident type with the largest percentage decrease and associated location.

Narrative Example Output:

Once you've calculated the measures, use Smart Narrative or custom text boxes in Power BI to display the dynamic sentences. Example:

  • "The total amount of incidents grew in Q2 to Q3 by 20%."
  • "Glasgow had the highest amount of incidents from Q2 to Q3, growing by 25%."
  • "Medical concern incidents increased from Q2 to Q3 by 30%, with Glasgow having the most at 40%."
  • "Aggression incidents decreased from Q2 to Q3 in Manchester by 10%, with Manchester having the largest decrease of 15%."

This approach ensures your report updates dynamically as new data is ingested, and narratives remain accurate and quarter-specific.

 

Please mark this as solution if it helps you. Appreciate Kudos.

I've made the summarized data table but I'm having trouble getting the Count column.:

Column_count = COUNT('Incidents'[Type of CCIA])

This is giving me the total of 15 in each cell instead of a 1 count. How can I correct that please?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.