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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Trying to return a unichar with hasonevalue() and using a measure

Trying to return a unichar with hasonevalue() and using a measure

 

ButtonHasFilter = if(hasonefilter('Staffing Report'[Location]),unichar(9744),unichar(9745))
 
but this is not working properly, I am getting all 9744 only even when there is no selection.
 
Is there a way I can use a measure inside hasonefilter()
I am using this measure for a table visual
 
Thanks
 
1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can create a measure like this:

A =
VAR _count =
    CALCULATE (
        COUNT ( 'Staffing Report'[Location] ),
        ALLSELECTED ( 'Staffing Report' )
    )
VAR allcount =
    CALCULATE ( COUNT ( 'Staffing Report'[Location] ), ALL ( 'Staffing Report' ) )
RETURN
    IF ( _count >= 1 && _count < allcount, UNICHAR ( 9745 ), UNICHAR ( 9744 ) )

1.png2.png

 

Best Regards,
Community Support Team _ Yingjie Li
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

5 REPLIES 5
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can create a measure like this:

A =
VAR _count =
    CALCULATE (
        COUNT ( 'Staffing Report'[Location] ),
        ALLSELECTED ( 'Staffing Report' )
    )
VAR allcount =
    CALCULATE ( COUNT ( 'Staffing Report'[Location] ), ALL ( 'Staffing Report' ) )
RETURN
    IF ( _count >= 1 && _count < allcount, UNICHAR ( 9745 ), UNICHAR ( 9744 ) )

1.png2.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@Anonymous - Are you using HASONEFILTER or HASONEVALUE? What is the formula for the measure? Is the measure Location?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

 

this is my measure,

 

Location_Sli =
VAR _overallloc =
CALCULATE (
ROUND ( [Overall % Mgmt] * 100, 0 ),
ALLEXCEPT ( 'Staffing Report', 'Staffing Report'[Location] )
)
VAR _redgreen =
IF ( _overallloc >= 90, "🟢", "🔴" )
VAR _location_sli =
IF (
MIN ( 'Staffing Report'[Location] ) = BLANK (),
BLANK (),
CONCATENATE (
CONCATENATE (
CONCATENATE ( _redgreen, MIN ( 'Staffing Report'[Location] ) ),
"-"
),
_overallloc & "%"
)
)
RETURN
_location_sli
 
I want to use this inside the ButtonHasFilter and return a unichar when there is a selection which is a checked box, otherwise an unchecked box.
 
Thanks for your help in advance @Greg_Deckler 

@Anonymous Well, I guess the simple answer is, you cannot use a measure in HASONEFILTER. According to the documentation, you have to use a column:

HASONEFILTER function (DAX) - DAX | Microsoft Docs

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Yes, I am aware but any work-around would be helpful here @Greg_Deckler 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.