Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Using a measure on the legend in a pie chart using directquery

I want the smaller pieces that are all less than 1% to be together in an "Other" slice. How can I do this?

I created a measure 

legend=IF( [%_value] <0.01,
    "Other",
    MAX(accounts[name])
)
 
which will put the correct names beneath "Other", but I can't use this measure in the legend.
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    Yes, Legend only accepts entity columns as values.

    Please new a calculated column like:

     

    Legend = 
    VAR _measure = CALCULATE([%_value],ALLEXCEPT('accounts','accounts'[name]))
    VAR _legend = IF(_measure>=0.01,'accounts'[name],"Others")
    RETURN
    _legend

     

    and then use it as legend's value.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Yes, Legend only accepts entity columns as values.

    Please new a calculated column like:

     

    Legend = 
    VAR _measure = CALCULATE([%_value],ALLEXCEPT('accounts','accounts'[name]))
    VAR _legend = IF(_measure>=0.01,'accounts'[name],"Others")
    RETURN
    _legend

     

    and then use it as legend's value.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Any update? If the question is still unresolved, you can continue to add details of the question below and feel free to contact us.😊

     

    Best Regards,
    Gao

    Community Support Team