Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Thomas_Salvan
New Member

Clustered bar chart with Date as X-Axis with dynamic granulometry

Hello

 

I'm struggelling with a cluster bart chart in wich I would like to see some data I have in a matrix.

I my Matrix, I have differnte kind of Events, link to a date, and every month, I have a number of event, every year a avergae number of event per month :

Thomas_Salvan_0-1739894155808.png

 

With the same set of data, I would like to have it in a Cluster bar chart

I have this : 

Thomas_Salvan_1-1739894333817.png

I can drill through, but it means like selecting a year.

Thomas_Salvan_2-1739894393749.png

I would like to be able to keep in the visual the other years, but to have the granularity of the month for the selected Years.

I try to have a second calendar, to be able to select a year without changing the overall set of data, but I cannot figure out how to build the X-axis with date showing some time year, some time month. As in the first Matrix, basically.

 

Thanks for your support

 

Thomas

 

 

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

You are trying to do too much.  The standard column chart visual can only drill through to the next level or expand the entire level.

lbendlin_0-1739928845711.png

 

Use a custom visual or rethink what you are trying to achieve, and select a different visual.

 

Power BI is not Excel.

 

View solution in original post

Anonymous
Not applicable

Hi @Thomas_Salvan ,

 

Thanks for the reply from lbendlin .

 

I understand your needs now. For example, you want to show the detail data for 2023 when 2023 is checked, and the other years are shown with the same granularity, right?

 

Here's my test data:

vhuijieymsft_0-1739956793194.png

 

Please create three calculated columns:

Month = FORMAT('Table'[Date],"mmmm")
Month_number = MONTH('Table'[Date])
Year = YEAR('Table'[Date])

 

Create a new table:

Table 2 =
UNION (
    SUMMARIZE (
        SELECTCOLUMNS (
            'Table',
            "_Month/Year", 'Table'[Month],
            "_Month/Year_Number", 'Table'[Month_number]
        ),
        [_Month/Year],
        [_Month/Year_Number]
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            SELECTCOLUMNS ( 'Table', "_Month/Year", 'Table'[Year] ),
            [_Month/Year]
        ),
        "_Month/Year_Number", [_Month/Year]
    )
)

vhuijieymsft_1-1739956793196.png

 

Please create a measure within this newly created table.

Measure =
VAR _Slicer =
    SELECTEDVALUE ( 'Table'[Date] )
RETURN
    IF (
        NOT ISFILTERED ( 'Table'[Year] ),
        CALCULATE (
            SUM ( 'Table'[Event Count] ),
            SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] ) = 'Table'[Year]
        ),
        IF (
            SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] ) <= 12,
            CALCULATE (
                SUM ( 'Table'[Event Count] ),
                'Table'[Month_number] = SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] )
            ),
            IF (
                SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] )
                    <> SELECTEDVALUE ( 'Table'[Year] ),
                CALCULATE (
                    SUM ( 'Table'[Event Count] ),
                    SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] ) = 'Table'[Year]
                )
            )
        )
    )

 

Have the “_Month/Year” column in Table 2 sorted by the “_Month/Year_Number” column so that it is displayed without error in the visualization.

vhuijieymsft_2-1739956908291.png

 

Use the Year column of the original table as the filter field for slicer.

vhuijieymsft_3-1739956908294.png

 

Please create clustered column chart. Put the “_Month/Year” column on the X-axis, Measure on the Y-axis, and the “Event type” column on the end, the final visual effect is shown below:

vhuijieymsft_4-1739956917829.png

 

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Thomas_Salvan ,

 

Thanks for the reply from lbendlin .

 

I understand your needs now. For example, you want to show the detail data for 2023 when 2023 is checked, and the other years are shown with the same granularity, right?

 

Here's my test data:

vhuijieymsft_0-1739956793194.png

 

Please create three calculated columns:

Month = FORMAT('Table'[Date],"mmmm")
Month_number = MONTH('Table'[Date])
Year = YEAR('Table'[Date])

 

Create a new table:

Table 2 =
UNION (
    SUMMARIZE (
        SELECTCOLUMNS (
            'Table',
            "_Month/Year", 'Table'[Month],
            "_Month/Year_Number", 'Table'[Month_number]
        ),
        [_Month/Year],
        [_Month/Year_Number]
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            SELECTCOLUMNS ( 'Table', "_Month/Year", 'Table'[Year] ),
            [_Month/Year]
        ),
        "_Month/Year_Number", [_Month/Year]
    )
)

vhuijieymsft_1-1739956793196.png

 

Please create a measure within this newly created table.

Measure =
VAR _Slicer =
    SELECTEDVALUE ( 'Table'[Date] )
RETURN
    IF (
        NOT ISFILTERED ( 'Table'[Year] ),
        CALCULATE (
            SUM ( 'Table'[Event Count] ),
            SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] ) = 'Table'[Year]
        ),
        IF (
            SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] ) <= 12,
            CALCULATE (
                SUM ( 'Table'[Event Count] ),
                'Table'[Month_number] = SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] )
            ),
            IF (
                SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] )
                    <> SELECTEDVALUE ( 'Table'[Year] ),
                CALCULATE (
                    SUM ( 'Table'[Event Count] ),
                    SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] ) = 'Table'[Year]
                )
            )
        )
    )

 

Have the “_Month/Year” column in Table 2 sorted by the “_Month/Year_Number” column so that it is displayed without error in the visualization.

vhuijieymsft_2-1739956908291.png

 

Use the Year column of the original table as the filter field for slicer.

vhuijieymsft_3-1739956908294.png

 

Please create clustered column chart. Put the “_Month/Year” column on the X-axis, Measure on the Y-axis, and the “Event type” column on the end, the final visual effect is shown below:

vhuijieymsft_4-1739956917829.png

 

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

lbendlin
Super User
Super User

You are trying to do too much.  The standard column chart visual can only drill through to the next level or expand the entire level.

lbendlin_0-1739928845711.png

 

Use a custom visual or rethink what you are trying to achieve, and select a different visual.

 

Power BI is not Excel.

 

Thanks a lot for your help

I made 2 small modifications : 

- I add a column to be able to sort the table _Month/Year starting with Year, then Month : 

Column = if(
    'Table 2'[_Month/Year_Number]<2000, 
    'Table 2'[_Month/Year_Number]*10000,
    'Table 2'[_Month/Year_Number])

Sorting the table like that give me first the years, then the months.

- I change :

SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] ) <> SELECTEDVALUE ( 'Table'[Year] )

To

SELECTEDVALUE ( 'Table 2'[_Month/Year_Number] ) < SELECTEDVALUE ( 'Table'[Year] )

It hides the years after the selection. As I compare months to the previous years, I don't need the next years.

 

Thanks a lot again

 

 

 

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.