Forum Discussion

BenBlackswan's avatar
BenBlackswan
Helper V
2 years ago
Solved

How to border on first level column header only?

Hello everyone,

 

I have a matrix table like the one below, as you can see, the column have two levels, financial year and quarters.

 

 

I would like to put border around the year only so that the reader can easily identify financial year when they read the matrix.

 

any help would be great.

 

  • SamWiseOwl's avatar
    SamWiseOwl
    2 years ago

    Hi BenBlackswan 

    You can be a bit sneaky and make the | only appear on the last Quarter. Then using conditional formatting to only format the cells with a | in them.

    Measure would be something like this:
    . =
    IF (
        SELECTEDVALUE ( Sales[SaleDate].[Quarter] ) --For the current quarter
            CALCULATE (
                MAX ( Sales[SaleDate].[Quarter] ), --is it equal to the max quarter
                ALLSELECTED ( Sales[SaleDate].[Quarter], Sales[SaleDate].[QuarterNo] )
            ),
        "|", --if it is return |
        BLANK () --Otherwise blank
    )

    Then conditionally format this column like this:

    If the cell contains a | return a black background.

    Make sure the measure is below your calculation in values.

    For the very first column use the grid border

    Hope this helps!

4 Replies

    • BenBlackswan's avatar
      BenBlackswan
      Helper V

      hi Sam,

       

      Thank you for the reply.

      That pipe separate technique is cool but will not work for my situation because I have two column while in the video, he only had one column header.

       

      If I add pipe separator on my visual's value box, pipe separator will end up at the end of every quarter. so it end up looking like this

       

      • SamWiseOwl's avatar
        SamWiseOwl
        Super User

        Hi BenBlackswan 

        You can be a bit sneaky and make the | only appear on the last Quarter. Then using conditional formatting to only format the cells with a | in them.

        Measure would be something like this:
        . =
        IF (
            SELECTEDVALUE ( Sales[SaleDate].[Quarter] ) --For the current quarter
                CALCULATE (
                    MAX ( Sales[SaleDate].[Quarter] ), --is it equal to the max quarter
                    ALLSELECTED ( Sales[SaleDate].[Quarter], Sales[SaleDate].[QuarterNo] )
                ),
            "|", --if it is return |
            BLANK () --Otherwise blank
        )

        Then conditionally format this column like this:

        If the cell contains a | return a black background.

        Make sure the measure is below your calculation in values.

        For the very first column use the grid border

        Hope this helps!