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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
elkay73
Frequent Visitor

Power BI Desktop Report Builder need help with measure to filter and show text.

I need the report to show which Attendees are self medicating.   Jane Doe should say Self Med in the Count of PassID# column.

elkay73_0-1744748262040.png

I can get the data to look correct until I try to add the text of 'Self Med'.  I must be missing something in the formula I'm using... 

Total Passes = if(Count(tblMEDPasses3[PassID#])=0,"Self Med",(Count(tblMEDPasses3[PassID#])))
When I use this it lists all of the Categories and ignores any filter I have on the page or visual.
Here is a link to my files.  One is the Excel file with the sample data and the other is the PBI report.
Thank you for your time.
 
 
1 ACCEPTED SOLUTION

I'm convinced this is a relationship issue.  Closing this and opening a new one requesting help with that.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @elkay73,

Thanks for reaching out to the Microsoft fabric community forum.

It looks like you're seeing unexpected behavior when trying to display "Self Med" in the Count of PassID# column is because DAX measures must return a consistent data type. Currently, your measure have numbers and text, which causes Power BI to treat the entire column as text. This can lead to issues like filters being ignored or the visual displaying all rows.

To achieve what you're trying to do, display the count of PassID# normally, but show "Self Med" when the count is zero.

You can use this approach : 

Total Passes (Text) =
VAR PassCount = CALCULATE(COUNT(tblMEDPasses3[PassID#]))
RETURN
IF(PassCount = 0, "Self Med", FORMAT(PassCount, "0"))

This version uses 'CALCULATE' to make sure it respects page and visual filters and 'FORMAT' to turn the count into text so that the entire measure returns a consistent text type.

 

I would also take a moment to thank @amitchandak, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

I was really hopeful as your description of why all rows were appearing makes sense.  Unfortunately, it is still showing all the rows.  I'm wondering if maybe it's due to the relationships I'm using?  I'll explore that next.

I'm convinced this is a relationship issue.  Closing this and opening a new one requesting help with that.

amitchandak
Super User
Super User

@elkay73 , Try like

Total Passes = if(isblank(Count(tblMEDPasses3[PassID#])) || Count(tblMEDPasses3[PassID#])=0,"Self Med",(Count(tblMEDPasses3[PassID#])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for your reply.  I tried it and there was no change.  It's still showing all of the Program Names.  It should only be showing 2.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

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.