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 Experts,
I have created two dynamic parameters 1. Dimension and 2. Measure, based on selection chart will be shown.
here my challenge is I have to show the ranking based on Dimension selection, if user select one dimension Rank should be based on particular dimension or if user select multiple selection with different table dimensions Rank should be shown based on highest value to lowest
Dynamic Rank = RANKX(ALLSELECTED(Products[ProductName], Category[Category Name]),[UC],,DESC)
this is giving an error "All column arguments of the ALL/ALLNOBLANKROW/ALLSELECTED/REMOVEFILTERS function must be from the same table."
PBI File:
https://drive.google.com/file/d/1QFcr-vsMz0HvJAfHNeFh4pxWSIq9aNt_/view
Could you please anyone help?
Solved! Go to Solution.
Hi @Raju_KCS
You want a dynamic rank that:
Responds to the Dimension selected by the user (dynamic parameter).
Ranks by Measure (another dynamic parameter).
Works for single or multiple dimension selections.
Current DAX formula:
Dynamic Rank = RANKX(
ALLSELECTED(Products[ProductName], Category[Category Name]),
[UC],
,
DESC
)
Error:
> "All column arguments of the ALL/ALLNOBLANKROW/ALLSELECTED/REMOVEFILTERS function must be from the same table."
This happens because ALLSELECTED cannot take columns from multiple tables unless they have a proper relationship and you wrap them inside ALLSELECTED(VALUES(...)) or combine via UNION/SELECTCOLUMNS.
_
Use SELECTEDVALUE and SWITCH to pick the dimension
If you have a dynamic Dimension parameter, create a helper table with all dimension options:
Dimension Parameter =
DATATABLE(
"Dimension", STRING,
{
{"Product"},
{"Category"}
}
)
Then create a Dynamic Rank measure:
Dynamic Rank =
VAR SelectedDimension = SELECTEDVALUE('Dimension Parameter'[Dimension])
RETURN
SWITCH(
TRUE(),
SelectedDimension = "Product",
RANKX(
ALLSELECTED(Products[ProductName]),
[UC],
,
DESC
),
SelectedDimension = "Category",
RANKX(
ALLSELECTED(Category[Category Name]),
[UC],
,
DESC
)
)
✅ How it works:
Checks which dimension is selected.
Applies ALLSELECTED only to the column of that table.
RANKX works without errors.
Best regards
Nabha Ahmed
Hi @Raju_KCS,
you can improve the solution with some practical adjustments. If your model allows, using a single unified dimension table for entities like Product and Category can simplify design and ranking, removing the need for complex unions and avoiding ALLSELECTED issues. For cases where users select multiple dimensions, create a virtual table with all relevant keys, add measure values, and rank accordingly to maintain consistency. It’s also helpful to add a tie-breaker to your ranking logic for equal values. Functions like ISINSCOPE or HASONEVALUE can help you detect the visual’s grain and adjust ranking. For better performance, calculate virtual tables once with variables and reuse them, and provide a fallback for when no dimension is selected to ensure predictable results.
Thank you.
Hi @Raju_KCS,
Since we haven't heard back from you yet, I'd like to confirm if you've successfully resolved this issue or if you need further help?
If you still have any questions or need more support, please feel free to let us know.
We are more than happy to continue to help you.
Hi @Raju_KCS,
we haven't heard back from you regarding our last response and wanted to check if your issue has been resolved.
Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!
Hi @Raju_KCS,
you can improve the solution with some practical adjustments. If your model allows, using a single unified dimension table for entities like Product and Category can simplify design and ranking, removing the need for complex unions and avoiding ALLSELECTED issues. For cases where users select multiple dimensions, create a virtual table with all relevant keys, add measure values, and rank accordingly to maintain consistency. It’s also helpful to add a tie-breaker to your ranking logic for equal values. Functions like ISINSCOPE or HASONEVALUE can help you detect the visual’s grain and adjust ranking. For better performance, calculate virtual tables once with variables and reuse them, and provide a fallback for when no dimension is selected to ensure predictable results.
Thank you.
Hi @Raju_KCS
You want a dynamic rank that:
Responds to the Dimension selected by the user (dynamic parameter).
Ranks by Measure (another dynamic parameter).
Works for single or multiple dimension selections.
Current DAX formula:
Dynamic Rank = RANKX(
ALLSELECTED(Products[ProductName], Category[Category Name]),
[UC],
,
DESC
)
Error:
> "All column arguments of the ALL/ALLNOBLANKROW/ALLSELECTED/REMOVEFILTERS function must be from the same table."
This happens because ALLSELECTED cannot take columns from multiple tables unless they have a proper relationship and you wrap them inside ALLSELECTED(VALUES(...)) or combine via UNION/SELECTCOLUMNS.
_
Use SELECTEDVALUE and SWITCH to pick the dimension
If you have a dynamic Dimension parameter, create a helper table with all dimension options:
Dimension Parameter =
DATATABLE(
"Dimension", STRING,
{
{"Product"},
{"Category"}
}
)
Then create a Dynamic Rank measure:
Dynamic Rank =
VAR SelectedDimension = SELECTEDVALUE('Dimension Parameter'[Dimension])
RETURN
SWITCH(
TRUE(),
SelectedDimension = "Product",
RANKX(
ALLSELECTED(Products[ProductName]),
[UC],
,
DESC
),
SelectedDimension = "Category",
RANKX(
ALLSELECTED(Category[Category Name]),
[UC],
,
DESC
)
)
✅ How it works:
Checks which dimension is selected.
Applies ALLSELECTED only to the column of that table.
RANKX works without errors.
Best regards
Nabha Ahmed
@Raju_KCS You will likely have better luck using the newer RANK function rather than RANKX. Sample data would be tremendously helpful here.
@GeraldGEmerick - Please find the PBI file in below location, I don't have access to attach the files.
https://drive.google.com/drive/folders/1BmWv1rMfsqzuZYpLrwtZzKMvJiFz9ULf
@Nabha-Ahmed - I have tried you're solution but no luck, could you please check the file.
Thank you for your valuable time spent on this thread.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 37 | |
| 33 | |
| 29 | |
| 27 |
| User | Count |
|---|---|
| 134 | |
| 104 | |
| 63 | |
| 60 | |
| 55 |