Forum Discussion
YoY + QoQ bar chart
Hi,
I am very new to Power BI and need a helping hand! I am trying to make a bar chart showing e.g. 2019 Q3, 2020 Q2 and 2020 Q3 (in that order) to show growth both QoQ and YoY. I have as of now made a Quarterly filter enabling me to manually select the needed quarters.
My problem arises as I would like my filter to be interactive in the way that when choosing the current quarter the other quarters would update automatically.
2 Replies
- AnonymousNot applicable
Hi Anonymous ,
Here is my sample data.
DateValue
1/1/2019 1 2/2/2019 5 3/3/2019 5 4/4/2019 7 5/5/2019 8 5/6/2019 9 6/6/2019 4 7/7/2019 1 8/1/2019 1 8/2/2019 5 9/1/2019 4 9/2/2019 6 10/1/2019 8 10/2/2019 7 11/15/2019 4 11/16/2019 1 1/5/2020 2 2/5/2020 3 3/5/2020 6 4/25/2020 4 5/15/2020 4 5/25/2020 7 6/25/2020 8 6/27/2020 9 7/1/2020 1 7/2/2020 5 8/8/2020 5 9/9/2020 1 10/10/2020 4 1.Create a calendar table. A relationship is established between the main table and the calendar table.
Calendar = ADDCOLUMNS(CALENDAR(DATE(2019,1,1),DATE(2020,12,10)),"YearQuarter",YEAR([Date])&"-"&QUARTER([Date]))2.Create a measure. Set the Measure value as a percentage output.
Measure = VAR _thisquarter = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Calendar', [YearQuarter] = SELECTEDVALUE ( 'Calendar'[YearQuarter] ) ) ) VAR _lastquarter = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Calendar' ), [YearQuarter] = LEFT ( SELECTEDVALUE ( 'Calendar'[YearQuarter] ), 4 ) - 1 & "-" & RIGHT ( SELECTEDVALUE ( 'Calendar'[YearQuarter] ), 1 ) ) ) VAR tt = LEFT ( SELECTEDVALUE ( 'Calendar'[YearQuarter] ), 4 ) - 1 & "-" & RIGHT ( SELECTEDVALUE ( 'Calendar'[YearQuarter] ), 1 ) RETURN DIVIDE ( _thisquarter - _lastquarter, _lastquarter )3.Create a slicer and a bar chart. The result is as follows
You can check more details from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Anonymous ,
Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Stephen Tao