This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi ,
We are working on Power BI reports for a client with below requirement:
Requirement:
We want to add a reference line in a bar chart below which is calculated as:
Average of TOP 10 weeks in the last 52 weeks (from today) for the selected Station and Circle (Station and Circle are slicers on the report).
Logic:
Step 1: Calculate a table for last 52 weeks
Last 52 Weeks Table = SELECTCOLUMNS (
FILTER ('Sheet1','Sheet1'[WEEKDIFF]>=1 && 'Sheet1'[WEEKDIFF] <=52),
"ACT HOURS",Sheet1[Actual Hrs],
"TONS PROD", Sheet1[Tons Produced],
"Week Number", Sheet1[Week Number],
"Year", Sheet1[Year],
"WeekEndDate", Sheet1[WeekEndDate],
"WEEKDIFF", Sheet1[WEEKDIFF])
Step 2: Add RANK Column for WeekYear based on metric TPH in the table created in Step 1.
Step 3: Create table for storing TOP 10 Weeks based on RANK Column created in Step 2.
Step 4: Calculate the AVERAGE of the 10 records returned in Step 3.
We are stuck on Step 2. Even though the calculation is on the new table its returning records older than 52 weeks. Also its important that the Average calculation should be dynamic , so the TOP 10 records should change as per slicer selections.
If anyone can help on the flow of logic and DAX functions it will be great, thanks.
Hi @eagerBI
Since I don't know your data model, I can only provide a general solution, If you have further more question about implementing in your scenario, please show me some example data and expected result.
For step2, you can follow the article
Dynamic TopN & Ranking in Power BI
For step3, please note that a new table can be dynamic based on a slicer.
For step4, Reference here
Best Reagrds
Maggie
Maggie
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 26 | |
| 25 | |
| 22 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 42 | |
| 41 | |
| 40 | |
| 21 | |
| 20 |