Forum Discussion
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
- SpartaBI
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- Pbiuserr
Post Prodigy
Hello
I actually managed to get an axis and measure for that
measure isLast3YearCurrentCurrentMonth = 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