Forum Discussion

spagad6263's avatar
spagad6263
Icon for Post Patron rankPost Patron
11 months ago
Solved

How to show barch chart FIRST column color?

Hi, I would like to set the first column of the barchart a different color. Below is the DAX but it doesn't work. I hope experts can help to provide advice. Thanks   meas_BarColor =  VAR Cur...
  • Jihwan_Kim's avatar
    11 months ago

    Hi,

    I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

     

    I assume some of the yearmonth category in the selected period show blank value.

     

     

     

     

    meas_BarColor = 
    VAR CurrentCategory =
        SELECTEDVALUE ( 'dim_Date'[YearMonth] )
    VAR FirstCategory =
        CALCULATE (
            MIN ( 'dim_Date'[YearMonth] ),
            FILTER ( ALLSELECTED ( 'dim_Date' ), [Sales:] <> BLANK () )
        )
    RETURN
        IF ( CurrentCategory = FirstCategory, "#FF0000", "#0000FF" )