Forum Discussion

Raghu3636's avatar
Raghu3636
Regular Visitor
1 year ago
Solved

Data Color Is not Visible | conditional format fx not visible for custom colors

Hi Team,    I am tryig to build clustered bar chart. My data looks similar to the below. I dropped VENDOR in Y axis, Quantity under X Axis, and ORDER_DATE in legends, to get the quantity comparisio...
  • Shravan133's avatar
    1 year ago

    Create a mesure for color logic:

    Order Date Color =
    VAR _MaxDate = MAX('YourTable'[ORDER_DATE])
    VAR _MinDate = MIN('YourTable'[ORDER_DATE])

    RETURN
    SWITCH(
    SELECTEDVALUE('YourTable'[ORDER_DATE]),
    _MaxDate, "#FF5733", -- 🔶 Orange for the latest date
    _MinDate, "#3498DB", -- 🔷 Blue for the older date
    "#808080" -- Default Gray (just in case)
    )

     

    Then apply condiotional formatting based on this measure.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Raghu3636,

    Actually, there is no direct way to apply conditional format for a dynamic date on the Legend in Power BI, which is by design.

     

    If you want this feature to be supported, you could raise an idea here:

    https://ideas.fabric.microsoft.com/

     

    As a workaround, you could consider to configure your bar chart as below, then create a measure to apply this condition format:

     

    Date Color = 
    VAR MaxDate = CALCULATE(MAX('Table'[ORDER_DATE]), ALL('Table'))
    VAR MinDate = CALCULATE(MIN('Table'[ORDER_DATE]), ALL('Table'))
    VAR CurrentDate = VALUES('Table'[ORDER_DATE])
    
    RETURN
        SWITCH(
            TRUE(),
            CurrentDate = MaxDate, "Max", 
            CurrentDate = MinDate, "Min", 
            "Other"
        )

    Here is the .pbix file for your reference: