Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
New to PowerBI so apologies if this should be obvious.
If I have the following data:
Fiscal YQ table
| YQ | rownum |
| 2020 Q 4 | 1 |
| 2020 Q 3 | 2 |
| 2020 Q 2 | 3 |
| 2020 Q 1 | 4 |
| 2019 Q 4 | 5 |
| 2019 Q 3 | 6 |
| 2019 Q 2 | 7 |
| 2019 Q 1 | 8 |
Then another table
| YQ | Rep | Net Amount USD |
| 2020 Q 4 | John Smith | 200 |
| 2020 Q 3 | Jane Doe | 500 |
| 2019 Q 4 | John Smith | 400 |
And I have a slicer on the YQ item, how would I ensure that:
A stacked bar chart only shows x numbers of items on the x axis. Specifically, I wanted to show a max of last 4 quarters in the past if nothing is filtered (I have multiple years of data, the chart gets crowded, but I don't want to filter this information out as people may want to review items 3 years in the past).
I had created a measure:
Solved! Go to Solution.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@Anonymous , Create a common qtr year table, join with both table . Create a Qtr year rank in that on year qtr
new column
Qtr Rank = RANKX(all('Date'),'Date'[Qtr Start date],,ASC,Dense)
measure
This Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])))
Last Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])-1))
last 4 Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'), 'Date'[Qtr Rank]>=max('Date'[Qtr Rank])-4 && 'Date'[Qtr Rank]<=max('Date'[Qtr Rank])))
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 32 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |