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 😉
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
Hey there! Continuing this thread because the issue is related to this question.
The problem I currently have with the main pbix (the data modek presented below reflects it, but the values, of course, are replaced):
- project_code of the slicers table is supposed to be used, well, as a slicer:
- if a project is selected via the project_code slicer, the table visual should be filtered accordingly. Below we can see that project 933 has those Part Numbers with different Physical Parts because Part Numbers are highlighted (NO SLICER APPLIED):
- But when I use the slicer on the right to get me project 933, Part Numbers are not highlighted anymore:
Basically, this is the main problem. I want those part numbers to be highlighted even when I select the project from the project_code of the slicers table.
(the data model should not be changed, and the slicer must be this project_code of the slicers table)