Skip to main content

How to Show a Message When a Gallery Is Empty in Power Apps

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

An empty gallery is just blank space: people can't tell whether the app is broken, still loading, or has nothing to show. Put a message in its place that says why it's empty, and what happens next.

Prerequisites​

Step 1: Add a Text Control for the Message​

Insert Display → Text next to the gallery, in the same container, and name it, for example lblEmptyMPS (How to Add a Text Control in Power Apps). Turn Auto height on so long messages wrap.

Step 2: Say Why It's Empty​

A good message says what's missing and who can fix it. The example has two reasons, picked with If and IsBlank:

lblEmptyMPS → Text
If(
IsBlank(MyJobTitle),
"Your Microsoft 365 profile has no job title, so there's no plan to show yet. Ask your IT admin to add one.",
"There's no plan for " & MyJobTitle & " yet. Competencies appear here once a manager adds them."
)

Step 3: Show It Only When There Are No Rows​

IsEmpty is true when a table has no rows. Add the loading flag, so the message doesn't flash while the data is still on its way:

lblEmptyMPS → Visible
!locIsLoading && IsEmpty(locMyPlan)

The formula bar with the Visible property of lblEmptyMPS set to !locIsLoading && IsEmpty(locMyPlan), the preview strip showing IsEmpty(locMyPlan) = true with Data type boolean, and the message There's no plan for Managing Director yet on the canvas

Give the gallery the opposite condition, so only one of them shows:

galMyPlanMPS → Visible
!locIsLoading && !IsEmpty(locMyPlan)

Step 4: Test It​

For the example's admin, the Managing Director, whose job title has no competencies on purpose, the screen in preview showed the message:

The My Plan screen in preview with the header and the message There's no plan for Managing Director yet. Competencies appear here once a manager adds them

When a gallery's Items is a data source rather than a variable, you can test the gallery itself: IsEmpty(galMyPlanMPS.AllItems). Microsoft describes AllItems as the items loaded in the gallery, which may be fewer than all the Items until more are loaded by scrolling (Gallery control). It's empty only when nothing has loaded.

Common Mistakes​

MistakeWhat happensDo this instead
No loading checkThe message flashes before the data arrivesAdd !locIsLoading
A vague message such as "No data"People don't know what to doSay what's missing and who can fix it
Using IsBlank on a tableIt tests for a blank value, not an empty tableUse IsEmpty

Troubleshooting​

SymptomLikely causeFix
The message shows on the canvas but not in the appThe variable is empty in Studio until OnVisible runsTest in preview
Message and gallery show togetherTheir Visible formulas overlapMake them exact opposites

FAQ​

An empty area looks like a fault. A message tells people the app worked and there's nothing to show yet.

Can the message be a heading or have an icon?​

Yes. Any control works, as long as its Visible uses the same condition.

Conclusion​

Put a Text control next to the gallery, with a message that explains why it's empty and Visible set to "not loading and no rows". Give the gallery the opposite condition.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.