Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
dtem
Regular Visitor

Conditional formatting when values are similar

Hi All,

 

I have a Table Visual that shows my data as shown below where I have business units in one company that conduct business with each other. Account1 belongs to Company1Account2 belongs to Company2Account3 belongs to Company3 etc. If all the transactions that occur over a period have been captured in both companies correctly, the sum of Account1 in Company2 and Account2 in Company1 should be equal to zero. I would like to conditionally format the corresponding accounts in each company such that the ones that give a sum of zero turn green and the ones that give a sum that is not equal to zero turn red. What is the best way to go about this? Kindly note the column with company names is also a value in the table.

 

CompanyAccount1Account2Account3Account4Account5Account6
Company1  0  -78701725.99  -678225154.9  -490016689.6  0-1296516724  
Company2  84650482.76  00001843534.90
Company3  678225154.9  00-47471943.940-13427928.55
Company4  490016689.6  047471943.940-1217982574  -325274417
Company5  0  00121798257400
Company6  1296516724  -1701843.6213427928.55325274417.100

 

Thank you all for your assistance!

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @dtem ,

 

Please try:

First, unpivot the Account columns:

vjianbolimsft_0-1688611924619.png

Then create a matrix visual:

vjianbolimsft_1-1688612094520.png

Conditional format:

Measure = 
var _a = "Account"&RIGHT(SELECTEDVALUE('Table (2)'[Company]),LEN(SUBSTITUTE(SELECTEDVALUE('Table (2)'[Company]),"Company","")))
var _b = "Company"&RIGHT(SELECTEDVALUE('Table (2)'[Attribute]),LEN(SUBSTITUTE(SELECTEDVALUE('Table (2)'[Attribute]),"Account","")))
var _c = CALCULATE(SUM('Table (2)'[Value]),FILTER(ALL('Table (2)'),[Attribute]=_a&&[Company]=_b))
return IF(SUM('Table (2)'[Value])+_c=0,"Green","Red")

vjianbolimsft_2-1688612791793.png

Final output:

vjianbolimsft_3-1688612869661.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @dtem ,

 

Please try:

First, unpivot the Account columns:

vjianbolimsft_0-1688611924619.png

Then create a matrix visual:

vjianbolimsft_1-1688612094520.png

Conditional format:

Measure = 
var _a = "Account"&RIGHT(SELECTEDVALUE('Table (2)'[Company]),LEN(SUBSTITUTE(SELECTEDVALUE('Table (2)'[Company]),"Company","")))
var _b = "Company"&RIGHT(SELECTEDVALUE('Table (2)'[Attribute]),LEN(SUBSTITUTE(SELECTEDVALUE('Table (2)'[Attribute]),"Account","")))
var _c = CALCULATE(SUM('Table (2)'[Value]),FILTER(ALL('Table (2)'),[Attribute]=_a&&[Company]=_b))
return IF(SUM('Table (2)'[Value])+_c=0,"Green","Red")

vjianbolimsft_2-1688612791793.png

Final output:

vjianbolimsft_3-1688612869661.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.