Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Display a stacked column chart visual with current year highlighted

Hi Consultants,

 

We have a requiremnt to highlight current year column in stacked column chart visual (like image below). When users land on this page it should automatically highlight current year column. Thanks in advance.

 

Cheers,

Sid

  • Hi Anonymous ,

     

    You may need below similar measures.

    current year = YEAR(TODAY())
    
    column value =
    IF (
        SELECTEDVALUE ( Table1[Date].[Year] ) = [current year],
        BLANK (),
        SUM ( Table1[Value] )
    )
    
    highlighted column =
    IF (
        SELECTEDVALUE ( Table1[Date].[Year] ) = [current year],
        CALCULATE (
            SUM ( Table1[Value] ),
            FILTER ( ALLSELECTED ( Table1 ), Table1[Date].[Year] = [current year] )
        ),
        BLANK ()
    )
    

    Drag corresponding field and measures into column chart and customize data colors to distinguish current year from others.

    Best regards,

    Yuliana Gu

1 Reply

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi Anonymous ,

     

    You may need below similar measures.

    current year = YEAR(TODAY())
    
    column value =
    IF (
        SELECTEDVALUE ( Table1[Date].[Year] ) = [current year],
        BLANK (),
        SUM ( Table1[Value] )
    )
    
    highlighted column =
    IF (
        SELECTEDVALUE ( Table1[Date].[Year] ) = [current year],
        CALCULATE (
            SUM ( Table1[Value] ),
            FILTER ( ALLSELECTED ( Table1 ), Table1[Date].[Year] = [current year] )
        ),
        BLANK ()
    )
    

    Drag corresponding field and measures into column chart and customize data colors to distinguish current year from others.

    Best regards,

    Yuliana Gu