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
Anonymous
Not applicable

HASONEVALUE + I need one more filter

Hi,

 

I have a slicer and I've been using  Filter = if(HASONEVALUE('Table name'[Column name])=False, 0, 1) to prevent any data to show in my matrix table if there's no selection, or if there's more than one selection in that slicer.

But now it happened that in my data for one KPI there is already only one row, and HASONEVALUE works in a way that it shows that one row no matter if there is a selection made in slicer or not.
 
SELECTEDVALUE would not work form as I use row level security where workers log in, and they don't need to select themself in slicer.
 
What other filter I could put to prevent that one KPI to show in matrix table?
 
Thanks in advance
1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

One option you could consider is using the USERNAME() function to filter the data in your matrix table based on the logged-in user. For example, you could use a filter like this:

Filter = IF(USERNAME() = 'Table name'[Column name], 1, 0)

This would show the data in the matrix table only if the logged-in user's username matches the value in the Column name column in the Table name table.

Alternatively, you could use a combination of HASONEVALUE and USERNAME to achieve the same effect. For example:

Filter = IF(AND(HASONEVALUE('Table name'[Column name]), USERNAME() = 'Table name'[Column name]), 1, 0)

This would show the data in the matrix table only if there is a single value selected in the slicer and the logged-in user's username matches the value in the Column name column in the Table name table.


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

One option you could consider is using the USERNAME() function to filter the data in your matrix table based on the logged-in user. For example, you could use a filter like this:

Filter = IF(USERNAME() = 'Table name'[Column name], 1, 0)

This would show the data in the matrix table only if the logged-in user's username matches the value in the Column name column in the Table name table.

Alternatively, you could use a combination of HASONEVALUE and USERNAME to achieve the same effect. For example:

Filter = IF(AND(HASONEVALUE('Table name'[Column name]), USERNAME() = 'Table name'[Column name]), 1, 0)

This would show the data in the matrix table only if there is a single value selected in the slicer and the logged-in user's username matches the value in the Column name column in the Table name table.


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

negi007
Community Champion
Community Champion

@Anonymous  see if something like below works for you

 

Sales_Condtion = if ((HASONEVALUE(Orders[Region]) && SELECTEDVALUE(Orders[City])="Agawam"),SUM(Orders[Sales]),0)



Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

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.