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
Pbiuserr
Post Prodigy
Post Prodigy

x axis with custom date bars

Hello,

I calculated a measure and I'd like to display it on clustered column chart, however instead of putting each year-month or each date, I'd like my axis to be

-current selection (so 06.2022)

-end of year last year (12.2021)

-end of year -2 years (12.2020)

and If I choose period of 2021 like february 2021 then

-current selection (so 02.2021)

-end of year last year (12.2020)

-end of year -2 years (12.2019)

is it possible to achieve?

2 REPLIES 2
SpartaBI
Community Champion
Community Champion

@Pbiuserr use the logic in this video, but instead using it in a slicer just put it on the X axis.
https://www.youtube.com/watch?v=fKygF7VEJnQ


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Hello
I actually managed to get an axis and measure for that
measure is

 
Last3YearCurrentCurrentMonth = 
VAR CurrentSelection =
 			VALUES('Calendar'[YEAR-MONTH])
VAR DataTab = 
            CALCULATETABLE(
                            SUMMARIZE('Calendar CurrentLastMonth',
                                        'Calendar CurrentLastMonth'[Year],
                                        'Calendar CurrentLastMonth'[Month]
                            ),
            'Calendar CurrentLastMonth'[YEAR-MONTH] = CurrentSelection
            
            )

VAR Relation =
            TREATAS(
                    DataTab,'Calendar'[Year],'Calendar'[MONTH NAME])
VAR Product = 
            CALCULATE(
                        [MyMeasure %],
                        Relation,
                        REMOVEFILTERS('Calendar')

)
RETURN 
Product
)

 

and [MyMeasure %] is DIVIDE ( [COUNT_YTD], [AverageCount2],0 )
REMOVEFILTERS() makes AverageCount2 bigger amount as it removes date filter context, but I'd like to keep it (its like 30k through dataset, but only 3k for June 2022), however if I removefilter from measure, my bars from chart (LY EndOfYear, Year-2 EndOfYear) disappears due to context

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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