Forum Discussion
Measure excluding row context
- Anonymous1 year ago
Hi liselotte ,
Please try this formula:
nr_Metallic_Accessories_2 = IF(MAX('fact_Accessory'[Is_Metallic]) in {0,1}, CALCULATE( SUM('fact_Accessory'[Is_Metallic]), ALLEXCEPT('fact_Accessory','fact_Accessory'[Model UID]) ))Result:
Best Regards,
Zhu
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi liselotte
To create a table showing Model Name, Factory, Style Name, and Nr Metallic Accessories with a consistent count of metallic accessories for each Model Name regardless of Style Name, you’ll want to do the following in DAX:
- Calculate the Distinct Count of Metallic Accessories for each Model Name with Is_Metallic = 1.
- Remove Filters on Style Name so that Nr Metallic Accessories is not affected by the Style dimension.
Here’s a measure that should achieve this:
Nr_Metallic_Accessories =
CALCULATE(
DISTINCTCOUNT('fact_Accessory'[Accessory UID]),
'fact_Accessory'[Is_Metallic] = 1,
REMOVEFILTERS('dim_Style'[Style UID]) // Removes the Style filter to avoid interference
)
Create a visual table with:
- Model Name, Factory, and Style Name from your dimension tables.
- Nr Metallic Accessories from the measure we just defined.
This measure should produce the same count of metallic accessories for each Model Name across all styles. Let me know if this approach works!
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
YouTube: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS