Forum Discussion
Show boxes grouped by selected year
I need to show a graph of bars grouped by year, it must be the year selected in the filter and the year before the one selected in the filter.
How can I do this?
I have tried to place the selected year and the previous year in measures and then in other measures add everything that coincides but does NOT work for me.
Something like this should be the PBIx:
Filter: YEAR
Graph: Bars grouped by Year selected and Year prior to the selected
2 Replies
- amitchandak
Super User
Syndicate_Admin , You should always use date table, marked as date table and then you can try measures like
example measures
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))//Only year vs Year, not a level below
This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA - v-luwang-msft
Community Support
Hi Syndicate_Admin ,
Could you pls share your sample data,remember to remove confidential data.
Best Regards
Lucien