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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
naninamu
Helper IV
Helper IV

Summing values using a Hash value

Hi everyone,

 

@Ritaf1983 thank you  - you have previously helped me out with something similar, but I'm still a bit confused and this is slightly different!

 

I have 3 tables which basically look like this (simplifed - in real life tables are much bigger)

 

naninamu_0-1739794921750.png

 

I need to work out how many times all the Colours appear given the groups and their hash codes listed in the first table.

 

For instance, A has the Hash Code 1111, which equates to the colours Red, Blue, Yellow, Green and Orange - so one count for each of these colors.

 

B has the Hash Code 2222 = Red, Blue, Pink, Purple and Grey. This means Red has appeared 2 times in total, Blue 2 times, Yellow, Green, Orange , Purple and Grey once.

 

Continue for all the other groups, decipher their hash to get the total count of colours.

 

How do I do this? How do I get the total count of each colour? If I try to sum the HashCode/Colour table somehow, how do I refer to the table with the Groups in it?

 

Just for fun I then also have to sum up all the scores per colour.. although I reckon I could work that out if I could work out my first question....

 

Thanks in advance everyone!!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @naninamu ,

 

Thanks 3CloudThomas for the quick reply. I have some other thoughts to add:

 

(1) My test data is the same as yours.

(2) We can create a measure. 

Measure 2 = COUNTROWS(FILTER('Table 1',[HashCode] in VALUES('Table 2'[HashCode])))

(3) Then the result is as follows.

vtangjiemsft_0-1739861776452.png

 

 

Best Regards,

Neeko Tang

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

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

Based on the 3 tables shared, show the expected result very clearly.  Also, share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Change the table to a Matrix. This will produce Drill Down hierarchy for the attributes

3CloudThomas_0-1739896409075.png

 

naninamu
Helper IV
Helper IV

Thanks so much. Could you sort of explain as if to an 8 year old exactly what is happening in the 2 Measures you've written? I'm still getting my head around exactly what they all mean... 

Anonymous
Not applicable

Hi @naninamu ,

 

Thanks 3CloudThomas for the quick reply. I have some other thoughts to add:

 

(1) My test data is the same as yours.

(2) We can create a measure. 

Measure 2 = COUNTROWS(FILTER('Table 1',[HashCode] in VALUES('Table 2'[HashCode])))

(3) Then the result is as follows.

vtangjiemsft_0-1739861776452.png

 

 

Best Regards,

Neeko Tang

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

naninamu
Helper IV
Helper IV

Hi @Anonymous  - probably me but when I do that all I'm getting is the HashCode/Colour table counting the colours in that table.

naninamu_0-1739833654400.png

naninamu_1-1739833675690.png

What I need is illustrated below. So if I put in the Group/HashCode/Colour into one table I get this:

 

naninamu_2-1739833722587.png

 

naninamu_3-1739833757248.png

So my final output needs to be a count of each colour ie

Blue = 10

Green = 5

Grey = 7 etc

 

Any help appreciated!!

 

naninamu
Helper IV
Helper IV

Thank you! That sounds quite simple ... maybe so was overthinking it... 😁

Anonymous
Not applicable

Create a Simple Count measure on the table with HashCode and Color. Then, just display the Color column in a table (or matrix, or column chart) and the measure. Do not include the HashCode column in the visuals

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors