Forum Discussion

abc_777's avatar
abc_777
Solution Specialist
2 years ago
Solved

hi

Hello,

 

Can some one help me to correct this measure

I want to use this in new KPI card under callout  settings inside font colur function so change font color as red and green

 

KPI Comparisons Colour =

VAR _sel = SELECTEDVALUE('KPI Comparisons'[KPI Comparisons Fields])
VAR _var = Switch(
    TRUE()
    , CONTAINSSTRING(_sel, "KPI Total Vs Last Month Quantity"), [KPI Total Vs Last Month Quantity]
    , CONTAINSSTRING(_sel, "KPI Total Vs Last Year Quantity"), [KPI Total Vs Last Year Quantity]
    , CONTAINSSTRING(_sel, "KPI Total Vs Same Month Last Year Quantity"), [KPI Total Vs Same Month Last Year Quantity]
    ,CONTAINSSTRING(_sel, "KPI Total Vs Target Vs Actual Quantity"), [KPI Total Vs Target Vs Actual Quantity] )
    --[KPI Total Vs Target Vs Actual Quantity])
   
    RETURN
        SWITCH(
            TRUE()
            ,_var > 0, "Green"
            , _var < 0, "Red"
            , "Black"

        )
 
its nt letting me to click ok. please make this correct
 
thanks

12 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion

    abc_777  - does this measure return the correct value if you put it in a table visualization?

     

    Are you using a live connection to dataset? If so, measures default to number - you need to manually update the data type to text before you'll be able to use it in conditional formatting. Just click the measure name in the data pane, then in the ribbon in the Measure Tools tab, change the data type to text. Then try to apply the conditional formatting again. 

     

    I've created an idea here for the data type so please vote for it if you have similar issue (even if that's not the problem here): https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=e582477a-a276-ee11-a81c-6045bdbdefa6

     

    If this doesn't fix this problem, let us know more details so we can provide better support.

    • abc_777's avatar
      abc_777
      Solution Specialist

      hello AllisonKennedy 

       

      thanks for your reply

       i have following measure and in ribbon pane under format they r text, here i have given 3 of them in scree shot

       

       

       

       

      then i have parameter table by fields, is also text type

       

       

      but when i create a measure for color or conditional format for callout ont color change this measure is whole number and i even cant see 'text' type in format inside the ribbon pane

       

       

      even by going to model view  then select the measure then try to change formatting drop down menu but TEXT is disabled

       

       

       

      so how can i use this measure as conditional format for change dynamic font colour

       

      please help me

       

      thanks

       

       

       

      • AllisonKennedy's avatar
        AllisonKennedy
        Community Champion

        abc_777  You need to change the 'data type' to text, not just the formatting. That option should be a little further left in the ribbon than the data format option. 

         

         

    • abc_777's avatar
      abc_777
      Solution Specialist

      AllisonKennedy 

       

      thanks for your reply,

       

      Nope there is no error in my measure as there is nothing yellow line at the bottom of the measure,

       

      but i use the measure in callout new card visual as font color, there could be error in my measure formula but sytem might not pick it.

       

      can you please check 

       

      i just try to implement https://www.youtube.com/watch?v=UOnkB1ExYp0 

      youtube new card visual in my power bi. at 16.30 min u will see he is create a measure and then use that in callout font.  same i want to so

       

      PLease help me to complete this

       

      thanks

      • AllisonKennedy's avatar
        AllisonKennedy
        Community Champion

        abc_777  I really think this has to do with the data type - can you try copying the measure formula and creating a new one? It may be a bug? Are you able to share the file by uploading to OneDrive?