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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RichOB
Post Partisan
Post Partisan

Need Help With Dynamic Insight Text Box

I've seen a few videos online about how to add dynamic insights into text boxes but I can't seem to get the measures to work properly with my data.  My real-life report will have year filters, so if the Location and Counts below could change with the year filter that would be great.

 

If I want 2 text boxes to say:

" ....(Location)...has the most number of incidents with...(Incident Count)"

"...(Location)...has had the police called...(Police Called Count)...times"

LocationIncident NumberPolice Called
ManchesterInc11
ManchesterInc20
ManchesterInc20
LondonInc41
LondonInc51
LondonInc61
LondonInc71
LondonInc81
NewcastleInc91
NewcastleInc101
NewcastleInc110


Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from saud968  and Selva-Salimi , please allow me to provide another insight:

Hi, @RichOB 

Regarding the issue you raised, my solution is as follows:

1.I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1730871188280.png

2.Firstly, you need to create the following calculated table and use it as a slicer, ensuring that the slicer does not directly affect the original data.

select1 = VALUES('Table'[Location])

 

vlinyulumsft_1-1730871246683.png

3. Below are the measure I've created for your needs:

Dynamic Text = 
VAR Location =
    MAX ( 'select1'[Location] )
VAR IncidentCount =
    COUNTROWS (
        FILTER ( 'Table', 'Table'[Location] = SELECTEDVALUE ( 'select1'[Location] ) )
    )
VAR PoliceCount =
    SUM ( 'Table'[Police Called] )
RETURN
    IF (
        ISFILTERED ( 'select1'[Location] ),
        Location & " has the most number of incidents with " & IncidentCount
            & UNICHAR ( 10 ) & Location & " has had the police called " & PoliceCount & " times.",
        BLANK ()
    )

4.Here's my final result, which I hope meets your requirements.

vlinyulumsft_2-1730871278177.png

vlinyulumsft_3-1730871278178.png

vlinyulumsft_4-1730871293473.png

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks for the reply from saud968  and Selva-Salimi , please allow me to provide another insight:

Hi, @RichOB 

Regarding the issue you raised, my solution is as follows:

1.I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1730871188280.png

2.Firstly, you need to create the following calculated table and use it as a slicer, ensuring that the slicer does not directly affect the original data.

select1 = VALUES('Table'[Location])

 

vlinyulumsft_1-1730871246683.png

3. Below are the measure I've created for your needs:

Dynamic Text = 
VAR Location =
    MAX ( 'select1'[Location] )
VAR IncidentCount =
    COUNTROWS (
        FILTER ( 'Table', 'Table'[Location] = SELECTEDVALUE ( 'select1'[Location] ) )
    )
VAR PoliceCount =
    SUM ( 'Table'[Police Called] )
RETURN
    IF (
        ISFILTERED ( 'select1'[Location] ),
        Location & " has the most number of incidents with " & IncidentCount
            & UNICHAR ( 10 ) & Location & " has had the police called " & PoliceCount & " times.",
        BLANK ()
    )

4.Here's my final result, which I hope meets your requirements.

vlinyulumsft_2-1730871278177.png

vlinyulumsft_3-1730871278178.png

vlinyulumsft_4-1730871293473.png

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

saud968
Memorable Member
Memorable Member

Measure to find the location with the most incidents:
LocationWithMostIncidents =
CALCULATE(
FIRSTNONBLANK('Table'[Location], 1),
TOPN(
1,
SUMMARIZE(
'Table',
'Table'[Location],
"IncidentCount", COUNT('Table'[Incident Number])
),
[IncidentCount], DESC
)
)

Measure to count incidents for that location:
IncidentCount =
CALCULATE(
COUNT('Table'[Incident Number]),
'Table'[Location] = [LocationWithMostIncidents]
)

Single measure to create the dynamic text:
IncidentText =
[LocationWithMostIncidents] & " has the most number of incidents with " & [IncidentCount]

Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!

Selva-Salimi
Solution Sage
Solution Sage

Hi @RichOB 

 

you can easily write a measure like following and add it to a "card" visual instead:

 

Measure = SELECTEDVALUE('Table'[Location]) & " has the most number of incidents with " & COUNT('Table'[incident])
 
and the same for the other one!
 
If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.