Forum Discussion
Conditional Formatting based on a specific rule
- 3 years ago
Then maybe this is what you are looking for?
Highlight different in all other projects = IF ( HASONEVALUE ( 'Table'[Part Number] ), VAR _FirstProject = MIN ( 'Table'[ProjectName] ) RETURN IF ( CALCULATE ( COUNTROWS ( VALUES ( 'Table'[ProjectName] ) ), ALLEXCEPT ( 'Table', 'Table'[Part Number] ) ) > 1, VAR _PhysicalPartNumbersCurrentProject = CALCULATETABLE ( VALUES ( 'Table'[Part Physical Number] ), 'Table'[ProjectName] = _FirstProject, ALL ( 'Table'[Part Physical Number] ) ) VAR _PhysicalPartNumbersOtherProjects = CALCULATETABLE ( VALUES ( 'Table'[Part Physical Number] ), 'Table'[ProjectName] <> _FirstProject, ALL ( 'Table'[Part Physical Number] ) ) VAR _DifferentPartNumbers = EXCEPT ( _PhysicalPartNumbersOtherProjects, _PhysicalPartNumbersCurrentProject ) VAR _CurrentProjectOnlyPartNumbers = EXCEPT ( _PhysicalPartNumbersCurrentProject, _PhysicalPartNumbersOtherProjects ) RETURN IF ( COUNTROWS ( _DifferentPartNumbers ) + COUNTROWS ( _CurrentProjectOnlyPartNumbers ) > 0, "orange" ) ) )Highlight different physical part numbers in other projects
- 3 years ago
Your download link doesn't work anymore, but according to your data model, this should work:
Highlight different in all other projects = CALCULATE( IF ( HASONEVALUE ( 'Parts'[Part Number] ), VAR _FirstProject = MIN ( 'Parts'[ProjectName] ) RETURN IF ( CALCULATE ( COUNTROWS ( VALUES ( 'Parts'[ProjectName] ) ), ALLEXCEPT ( 'Parts', 'Parts'[Part Number] ) ) > 1, VAR _PhysicalPartNumbersCurrentProject = CALCULATETABLE ( VALUES ( 'Parts'[Part Physical Number] ), 'Parts'[ProjectName] = _FirstProject, ALL ( 'Parts'[Part Physical Number] ) ) VAR _PhysicalPartNumbersOtherProjects = CALCULATETABLE ( VALUES ( 'Parts'[Part Physical Number] ), 'Parts'[ProjectName] <> _FirstProject, ALL ( 'Parts'[Part Physical Number] ) ) VAR _DifferentPartNumbers = EXCEPT ( _PhysicalPartNumbersOtherProjects, _PhysicalPartNumbersCurrentProject ) VAR _CurrentProjectOnlyPartNumbers = EXCEPT ( _PhysicalPartNumbersCurrentProject, _PhysicalPartNumbersOtherProjects ) RETURN IF ( COUNTROWS ( _DifferentPartNumbers ) + COUNTROWS ( _CurrentProjectOnlyPartNumbers ) > 0, "orange" ) ) ), ALL ( 'slicers'[project_code] ), ALL ( 'pj_code'[project_code] ) )I'd love to see your Power BI guidelines 😉
Okay, now the problem is that projects that are part number and part physical are assigned to prevent the measure to work properly. Is it because of the filter context?
What do you refer to as "projects"? Your data model knows only Table.Part Number and Table.Part Physical. Would you mind posting your latest file?
- Anonymous3 years agoNot applicable
I am so sorry for the confusion, here are the details and update pbix:
Some Part Numbers belong to different projects:-
And, as you can see, the physical number is the same, meaning that this is one part they are using.
Some of the Part Numbers belong to different projects, but have different Physical Parts:
My desired outcome: measure (or anything) that:1) Calculates whether a Part Number belongs to different projects
2) If it belongs, check whether it has the same Physical Number
3) If it does not have the same Physical Number, it highlights Part Number color orange
- Martin_D3 years agoSolution Sage
Then probably this is what you are looking for:
Highlight different and in project = IF ( HASONEVALUE ( 'Table'[Part Number] ), IF ( AND ( COUNTROWS ( VALUES ('Table'[ProjectName] ) ) > 0, COUNTROWS ( FILTER ( 'Table', SELECTEDVALUE ( 'Table'[Part Number] ) <> SELECTEDVALUE ( 'Table'[Part Physical Number] ) ) ) > 0 ), "orange" ) )Highlight part number if physical part number is different in project context
- Anonymous3 years agoNot applicable
Almost there, but there are a couple of things:
1) If the part number and physical number are the same - we live them as they are, I don't need them colored
2) If the Part number and Physical part are different - it is okay, as long as they are the same in a project context:
- You can see that the projects are different, but the part numbers are the same, and the physical parts are the same, which means I don't need them colored
3) I need to color Part Numbers that: are the same in different projects but have different physical parts:
Here you can see that the projects are different, part numbers are the same, but the physical parts are different. In this case, I need Part Number 1410566 to be colored orange