Forum Discussion
Column Chart - Past 6 Months
How would you show the last 6 months on a column chart (on the X axis).
So if I want to show the previous 6 months of April I want it to appear as the following
Nov > Dic > Jan > Feb > Mar> April
3 Replies
- AnonymousNot applicableJust create a measure that will return 1 for the months you want to display and BLANK for others and then filter the visual by this measure.
More specifically, the measure should sense the last month in the current context and make sure that for the 6 last months it returns 1 and for all others 0 (or BLANK). Then filter the visual by setting the measure's value to 1.
Best
D - v-juanli-msftCommunity Support
Hi Anonymous
Show last 6 months data, you could create measures
last month = EDATE(TODAY(),-1) Measure 2 = CALCULATE(SUM('Table'[value]),FILTER('date',DATEDIFF([Date],[last month],MONTH) in {0,1,2,3,4,5}))To sort the month name as expected, you could refer to the following:
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
If it doesn't solve your problem, you could use format "2019-02" instead of "Feb" which can order the axis as expected.
Use FORMAT([date],"yyyy-mm") can get this format.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
It's not working for me... I must be doing something wrong.