Forum Discussion

Another_User's avatar
Another_User
Frequent Visitor
2 years ago
Solved

Calculation groups and Color measures

Hello, everybody.   I have a very simple bar visual with active and inactive computers. To color the bar, we use this measure called "ColorMeasure":   SWITCH (     SELECTEDVALUE ( Device[Status...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Another_User ,

    Thanks for amitchandak answer. Based on your reply, I have some ideas that I want to share.

     

     

     

    % (Percent) = IF( CONTAINSSTRING(SELECTEDMEASURE(), "Color"), SELECTEDMEASURE(),
    DIVIDE(SELECTEDMEASURE(), [TotalDevices]) )

     

     

     

    the approach won't work as expected because returns the value of the measure, not its name, and thus cannot be used to check the measure's

    To address this issue, you might consider the following approach:

    1. Separate Measures for Coloring: Ensure that measures used for conditional formatting (like your "ColorMeasure") are not included or referenced in calculation groups that perform numerical operations. This separation is crucial because calculation groups apply transformations to measure values, which is incompatible with the nature of color encoding measures.

    2. Use Calculation Items Conditionally: Instead of trying to exclude the "ColorMeasure" directly within the calculation item's formula, you can apply the calculation item conditionally in your report visuals. When setting up your visuals, explicitly use the appropriate measure (absolute numbers or percentage) and apply the "ColorMeasure" only for the visuals where it's relevant. This way, you avoid the calculation group's logic being applied to the "ColorMeasure".

    Best Regards,

    Xianda Tang

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