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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
powerbiexpert22
Impactful Individual
Impactful Individual

grouping labels on x axis

is it possible to show group lables on x axis like below highlighted 

 

powerbiexpert22_0-1716433229209.png

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

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.

In calendar_dimension table, I tried to create Group Quarter-Year calculated column and Group Quarter-Year sort calculated column.

 

Jihwan_Kim_1-1716435200009.png

 

 

Jihwan_Kim_0-1716435135549.png

 

Group Quarter-Year = 
VAR _today =
    TODAY ()
VAR _indexquarteryear =
    ROWNUMBER (
        VALUES ( calendar_dim[End of Quarter] ),
        ORDERBY ( calendar_dim[End of Quarter], ASC )
    )
VAR _todayindex =
    MAXX (
        FILTER (
            ADDCOLUMNS (
                calendar_dim,
                "@indexquarteryear",
                    ROWNUMBER (
                        VALUES ( calendar_dim[End of Quarter] ),
                        ORDERBY ( calendar_dim[End of Quarter], ASC )
                    )
            ),
            calendar_dim[date] = _today
        ),
        [@indexquarteryear]
    )
RETURN
    SWITCH (
        TRUE (),
        _indexquarteryear <= _todayindex
            && _indexquarteryear >= _todayindex - 2, "Current Engagement",
        _indexquarteryear <= _todayindex - 3
            && _indexquarteryear >= _todayindex - 5, "Initial Interactions",
        _indexquarteryear <= _todayindex - 6, "Purchased",
        _indexquarteryear > _todayindex, "Future ML prediction",
        "Check again"
    )

 

 

Group Quarter-Year sort = 
VAR _today =
    TODAY ()
VAR _indexquarteryear =
    ROWNUMBER (
        VALUES ( calendar_dim[End of Quarter] ),
        ORDERBY ( calendar_dim[End of Quarter], ASC )
    )
VAR _todayindex =
    MAXX (
        FILTER (
            ADDCOLUMNS (
                calendar_dim,
                "@indexquarteryear",
                    ROWNUMBER (
                        VALUES ( calendar_dim[End of Quarter] ),
                        ORDERBY ( calendar_dim[End of Quarter], ASC )
                    )
            ),
            calendar_dim[date] = _today
        ),
        [@indexquarteryear]
    )
RETURN
    SWITCH (
        TRUE (),
        _indexquarteryear <= _todayindex
            && _indexquarteryear >= _todayindex - 2, 0,
        _indexquarteryear <= _todayindex - 3
            && _indexquarteryear >= _todayindex - 5, -1,
        _indexquarteryear <= _todayindex - 6, -2,
        _indexquarteryear > _todayindex, 1,
        100
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

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.

In calendar_dimension table, I tried to create Group Quarter-Year calculated column and Group Quarter-Year sort calculated column.

 

Jihwan_Kim_1-1716435200009.png

 

 

Jihwan_Kim_0-1716435135549.png

 

Group Quarter-Year = 
VAR _today =
    TODAY ()
VAR _indexquarteryear =
    ROWNUMBER (
        VALUES ( calendar_dim[End of Quarter] ),
        ORDERBY ( calendar_dim[End of Quarter], ASC )
    )
VAR _todayindex =
    MAXX (
        FILTER (
            ADDCOLUMNS (
                calendar_dim,
                "@indexquarteryear",
                    ROWNUMBER (
                        VALUES ( calendar_dim[End of Quarter] ),
                        ORDERBY ( calendar_dim[End of Quarter], ASC )
                    )
            ),
            calendar_dim[date] = _today
        ),
        [@indexquarteryear]
    )
RETURN
    SWITCH (
        TRUE (),
        _indexquarteryear <= _todayindex
            && _indexquarteryear >= _todayindex - 2, "Current Engagement",
        _indexquarteryear <= _todayindex - 3
            && _indexquarteryear >= _todayindex - 5, "Initial Interactions",
        _indexquarteryear <= _todayindex - 6, "Purchased",
        _indexquarteryear > _todayindex, "Future ML prediction",
        "Check again"
    )

 

 

Group Quarter-Year sort = 
VAR _today =
    TODAY ()
VAR _indexquarteryear =
    ROWNUMBER (
        VALUES ( calendar_dim[End of Quarter] ),
        ORDERBY ( calendar_dim[End of Quarter], ASC )
    )
VAR _todayindex =
    MAXX (
        FILTER (
            ADDCOLUMNS (
                calendar_dim,
                "@indexquarteryear",
                    ROWNUMBER (
                        VALUES ( calendar_dim[End of Quarter] ),
                        ORDERBY ( calendar_dim[End of Quarter], ASC )
                    )
            ),
            calendar_dim[date] = _today
        ),
        [@indexquarteryear]
    )
RETURN
    SWITCH (
        TRUE (),
        _indexquarteryear <= _todayindex
            && _indexquarteryear >= _todayindex - 2, 0,
        _indexquarteryear <= _todayindex - 3
            && _indexquarteryear >= _todayindex - 5, -1,
        _indexquarteryear <= _todayindex - 6, -2,
        _indexquarteryear > _todayindex, 1,
        100
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
danextian
Super User
Super User

Hi @powerbiexpert22 ,

 

In what way do you want the label to grouped? For example, for initial purchase which has two quarters, there is just a single label?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian , sorry i should not use the word group however this is what i wanted to acheive

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors