Forum Discussion
MAQ Dot Plot – Custom legend colors not working when selected value has no data (blank)
Hi Team,
I am working on a MAQ Dot Plot visual in Power BI Dashbaord where I compare one selected company against a cohort of multiple company's
I am using two disconnected slicers one for a single selected company and another for multiple cohort company's. I created a DAX measure that checks if the current row’s company belongs to the selected slicer or the cohort slicer using VALUES and IN logic. Based on this, I return a flag (1 for selected, 0 for cohort) and use it in the visual for conditional formatting and filtering
1. Scenario / Requirement
Selected company (single select)
Cohort company's (multi-select)
Requirement:
Selected company → highlighted in Orange (#ED7D31)
Cohort company's → shown in Blue (#2994C7)
Selected company has NO data → Treat as cohorts blue color (#2994C7)
Legend Calculation:
I am using the following DAX for legend:
School Selected =
VAR SelectedValues =VALUES('Slicer Selected company '[Selected company])
RETURN
IF(MAX(Selectedcompany[companyName]) IN SelectedValues,1,0)
Issue:
- This setup was working correctly earlier. However, recently I have noticed a change in behavior. When the selected company has no data (returns blank), the visual removes that data point and only cohort data remains. In this situation, the MAQ Dot Plot no longer applies the expected cohort color and instead defaults to a grey/black color.
However now:
- When the selected company has no data (blank)
- That data point disappears (expected)
- But then the visual shows only cohort values, legend collapses into a single category and all dots turn default grey/black instead of blue
Note: This breaks the custom color logic.
Observed Behavior:
- If selected company has data → colors work correctly
- If selected company has NO data → Only cohort remains visual shows default grey/black color.
Additional Details:
- Using numeric legend (1 / 0) for color mapping
- Gradient coloring Minimum color Blue (#2994C7) and Maxnimum color Orange (#ED7D31)
- Tables are partially disconnected (using DAX logic for filtering)
It seems that:
- When selected company has no data, the measure returns BLANK
- Power BI removes that row
- Only one legend category (0 = cohort) remains
- MAQ Dot Plot fails to apply custom colors and defaults to grey
Question's:
- Is this expected behavior in MAQ Dot Plot when only one legend category exists?
- Have there been any recent updates or changes in Power BI or the MAQ visual that could have affected this behavior?
- How can I:
- Maintain custom colors even when selected data is missing?
- Prevent fallback to default grey color?
- Is there a recommended way to always preserve legend categories in MAQ visuals?
Please any guidance or best practices would be greatly appreciated.
Thanks,
Pradeep
- Anonymous4 months ago
Hi deepuaits ,
Thanks for reaching out to Fabric Community Forum.The behavior may be occurring because the legend value is being generated dynamically through a measure. In Power BI, measures do not create fixed legend categories; they return values based on the data points available after applying filters and slicer selections.
In this scenario, the legend measure creates two categories: one for the selected company and one for the cohort companies. When the selected company has data, both categories are available in the visual context, so the MAQ Dot Plot can apply the expected color mapping , orange for the selected company and blue for the cohort.
When the selected company has no data, the selected company's data point may be removed from the visual context. As a result, the legend may contain only the cohort category. If the visual receives only one legend category, the existing color mapping may not be applied and the visual may fall back to its default formatting.
This behavior may occur because the legend categories are derived from the data points available in the visual context. The DAX logic itself may not be the issue; instead, the missing category may no longer be available for the visual to evaluate.
One possible approach is to keep the legend categories independent from the data by using a static/disconnected legend table. This keeps both categories available even when one category has no data. The measure can then determine whether a company belongs to the selected group or cohort group, while the legend remains consistent.
By maintaining fixed legend categories, the visual should continue applying the expected colors even when the selected company has no records. This ensures the legend domain remains fixed, helping prevent category drop-off and avoiding the MAQ Dot Plot default grey behavior.
Thank you.
3 Replies
- AnonymousNot applicable
Hi deepuaits ,
Thanks for reaching out to Fabric Community Forum.The behavior may be occurring because the legend value is being generated dynamically through a measure. In Power BI, measures do not create fixed legend categories; they return values based on the data points available after applying filters and slicer selections.
In this scenario, the legend measure creates two categories: one for the selected company and one for the cohort companies. When the selected company has data, both categories are available in the visual context, so the MAQ Dot Plot can apply the expected color mapping , orange for the selected company and blue for the cohort.
When the selected company has no data, the selected company's data point may be removed from the visual context. As a result, the legend may contain only the cohort category. If the visual receives only one legend category, the existing color mapping may not be applied and the visual may fall back to its default formatting.
This behavior may occur because the legend categories are derived from the data points available in the visual context. The DAX logic itself may not be the issue; instead, the missing category may no longer be available for the visual to evaluate.
One possible approach is to keep the legend categories independent from the data by using a static/disconnected legend table. This keeps both categories available even when one category has no data. The measure can then determine whether a company belongs to the selected group or cohort group, while the legend remains consistent.
By maintaining fixed legend categories, the visual should continue applying the expected colors even when the selected company has no records. This ensures the legend domain remains fixed, helping prevent category drop-off and avoiding the MAQ Dot Plot default grey behavior.
Thank you.- AnonymousNot applicable
Hi deepuaits ,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you
- AnonymousNot applicable
Hi,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.