sfuhr's avatar
sfuhr
Frequent Visitor
7 years ago
Status:
New

Bug using switch() function with unichar()

Hello to all! I try to display 2 different symbols in a table depending on a status - here is the small dax function:

 

test status = SWITCH(TRUE();
    [Projectstatus] = 0; UNICHAR(9940);
    [Projectstatus] = 1; UNICHAR(9989);
    "")

Code works for different unichar-values - it seems to be a problem with the number range that i'm in. It ends in the result that the unichar(9989) is displayed for all rows:

 

Selecting only the status "0" the result is correct:

 

Selecting other values the result is correct:

 

 

The current work around is adding a additional character to one of the 2 unichar() expressions:

 

status char = SWITCH(TRUE();
    AVERAGE(Testtabelle[Status]) = 1; UNICHAR(9989);
    AVERAGE(Testtabelle[Status]) = 0; UNICHAR(9940)&" "; 
    ""
)

Howerver not perfect and seems to me like a bug - in case you have any questions feel free to contact me!

 

Best regards & thx for the fix!

Stephan

 

 

7 Comments

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Community Support

    Hi sfuhr ,

     

    I have tested in the latest Power BI desktop version and your first DAX is working. I would suggest you update your Power BI desktop to the latest version 2.66.5376.2521 as ours then test again. 

     

     

     

    Best Regards,
    Qiuyun Yu 

  • sfuhr's avatar
    sfuhr
    Frequent Visitor

    Hello Quiyun -

     

    that is exactly what i'm using - so happy to know, that this works for you - might be a issue with country settings!?

     

    Kind regards,

    Stephan

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Community Support

    Hi sfuhr ,

     

    Both Power BI desktop regional settings and OS regions are English (United States). Please try to change your regional settings as ours then test again to see if the issue occurs? 

     

    Or may I know what's your Power BI desktop and OS regions? 

     

    Best Regards,

    Qiuyun Yu 

  • Hi, currently I'm having the same problems when using 3 unichar codes as you can see in the following picture:

    My version of PI Desktop is from December 2019 . Any idea of solution?

    Versión: 2.76.5678.782 64-bit (diciembre de 2019)

     

    Regards,

    Joao

  • Nolock's avatar
    Nolock
    Resident Rockstar

    The general recommendation is always having the current version of Power BI Desktop. Both earlier mentioned scenarios for calculated columns in DAX work in the PBI Desktop March 2020.

     

    Btw. you don't need to use the UNICHAR function with these UNICODE codes, use UNICODE characters instead of it (https://emojipedia.org/)