Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have table :
Sales
ProductCat ProductGroup Sales
1 1 100
2 1 105
3 2 34
4 2 23
5 5 1000
I need to filter out Product Cat 5 and then add a rank column, partitioned by ProductGroup i.e. :
ProductCat ProductGroup Sales Rank
1 1 100 2
2 1 105 1
3 2 34 1
4 2 23 2
I can do the rank with :
ADDCOLUMNS('Sales', "Rank", RANKX(CALCULATETABLE('Sales', ALLEXCEPT('Sales', 'Sales[ProductGroup]), 'Sales'[Sales])
One thing I'm struggling with filtering out ProductCat 5 before running the RANKX. I tried adding it into CALCULATETABLE as an additional filter but this has no effect due to the ALLEXCEPT. I've tried a nested CALCULATETABLE with the filter but this has no effect either.
Any ideas how I can apply a filter prior to CALCULATETABLE?
Solved! Go to Solution.
Easy answer is to try this:
One thing you can do is use a MEASURE instead. That will enable you to create a table visualization that can have the measure added to it. Then you can filter that visual to exclude category 5 and the rankings will update.
Has this post solved your problem? Please mark it as a 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.
I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.
https://sites.google.com/site/allisonkennedycv
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
Easy answer is to try this:
One thing you can do is use a MEASURE instead. That will enable you to create a table visualization that can have the measure added to it. Then you can filter that visual to exclude category 5 and the rankings will update.
Has this post solved your problem? Please mark it as a 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.
I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.
https://sites.google.com/site/allisonkennedycv
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
Just to clarify. Are you trying to make a measure? calculated column? or calculated table? Depending on what your goal, I would suggest a simpler DAX expression to achieve your goal.
FYI that you can just add a term to your Calculatetable( ) expression to filter out ProductCat <> 5 after the Allexcept() clause. Note there seems to be a missing parentheses after that anyway.
Regards,
Pat
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I'm sticking with table at the moment as there's more processing to do. We can't add filters in CALCULATE as filter context is being amended by allselected().
I will try applying the filter in an outer calculate.
This article explains it all
https://www.sqlbi.com/articles/order-of-evaluation-in-calculate-parameters/
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
18 | |
15 | |
14 | |
11 | |
8 |
User | Count |
---|---|
24 | |
19 | |
12 | |
11 | |
10 |