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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
TejasShah
Helper I
Helper I

Compare 2 visual tables and add condition

It'll be really helpful if someone can guide me since I have this case since a long time and couldn't get any related online solution for the same.

I have 2 databases from where I have annual data of last year and daily current data for the current year.

From those dbs, I have created 2 visual tables by filtering the columns as per requirement and calculating the averages for all the 4 types of the product for 5 different tracing stations.

 

Following are the 2 table visuals which are created:

 

Annual Avg. data   
Cell noType1Type2Type3Type4
13.1351.24488.9852.76
23.7455.72502.34888
34.1152.5499.2891.6
43.5653.65501.67864.22
53.7957.8496.4867.9

 

Daily Avg. Data   
Cell noType1Type2Type3Type4
1349.48490.1858.5
23.8156.11506.25881.93
34.5253500.9887.47
44.156.23500.12865
53.2258.31492.59866.2

 

Now, I need to compare the values of Annual Average data for particular type and particular cell no. to it's respective data in the Daily Average data table, with conditions:

for example: If Cell 1, type2 Daily average data is in range of (Cell 1, type2 Annual average data +-10),

then highlight it as Green or else Red and so on.

 

I tried using the graphically method but the mean itself couldn't be collated in a single graph since both the datas are from different datasources, so average of that particular type displays same average value for all 5 cell types.

 

Requesting for your support, thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @TejasShah 

 

Not sure how your source data looks like, so I create a simple demo to show a general and simple practice. 

 

Assume that your data table is like below. This is a friendly format for Power BI and will make follow-up calculations easier. If your tables are not in this format, you can use Power Query to transform them into this format in advance. 

vjingzhanmsft_0-1709002272308.png

 

Add two dimension tables for Cell No and Types. Then link them to Cell No column and Type column in both Annual and Daily tables. This follows the star schema model idea. 

vjingzhanmsft_1-1709002479242.png

 

Then create matrix visuals instead table visuals. Use Dimension tables' Cell No and Type column on row and column in both matrices. Create measures to calculate the Avgs for each. 

 

Then create the following measure for color formatting. In this measure, compare the daily Avg measure with Annual Avg measure. 

Color = 
VAR _DailyAvg = [Daily Avg]
VAR _AnnualAvg = [Annual Avg]
RETURN
IF(_DailyAvg>=_AnnualAvg-10 && _DailyAvg<=_AnnualAvg+10, "Green", "Red")

vjingzhanmsft_2-1709002837811.png

Hope this would be helpful. If you have any question, feel free to ask and @ me. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @TejasShah 

 

Not sure how your source data looks like, so I create a simple demo to show a general and simple practice. 

 

Assume that your data table is like below. This is a friendly format for Power BI and will make follow-up calculations easier. If your tables are not in this format, you can use Power Query to transform them into this format in advance. 

vjingzhanmsft_0-1709002272308.png

 

Add two dimension tables for Cell No and Types. Then link them to Cell No column and Type column in both Annual and Daily tables. This follows the star schema model idea. 

vjingzhanmsft_1-1709002479242.png

 

Then create matrix visuals instead table visuals. Use Dimension tables' Cell No and Type column on row and column in both matrices. Create measures to calculate the Avgs for each. 

 

Then create the following measure for color formatting. In this measure, compare the daily Avg measure with Annual Avg measure. 

Color = 
VAR _DailyAvg = [Daily Avg]
VAR _AnnualAvg = [Annual Avg]
RETURN
IF(_DailyAvg>=_AnnualAvg-10 && _DailyAvg<=_AnnualAvg+10, "Green", "Red")

vjingzhanmsft_2-1709002837811.png

Hope this would be helpful. If you have any question, feel free to ask and @ me. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.