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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Elshad
Frequent Visitor

Comparing individual value with Region

Hi

 

I'm creating visuals in Power Bi desktop but I'm having trouble with an issue.

 

İ need to compare individual data with a region data. Here is two separate tables I have

Here I need to select any data (can be selected via slicer or page filtering) from columns (e.g. SEO score for domain3.com) and I want to show it in the bar gragh. Result will be 79.

table1.jpg

 

 

 

 

 

 

 

And next to the bar grah I want to show SEO region average data with a bar graph for domain3.com. Result could be like this:

(domain1.com+domain2.com+domain3.com+domain5.com+domain6.com)/5=(83+90+79+76+91)/5=83.8. We need to select Europe region it is because domain3.com is related Europe region.

table2.png

I need to create DAX (custom measure for this) but not sure which functions need to be used.  Please see the result below in the screenshot.  

table3.png

Any help is much appreciated. 

Elshad

1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

[Avg SEO] = AVERAGE( T[SEO] )

[Region Average] =
CALCULATE(
    [Avg SEO],
    REMOVEFILTERS( T[Domain] ),
    KEEPFILTERS( VALUES( T[Region Name] ) )
)

View solution in original post

5 REPLIES 5
Elshad
Frequent Visitor

Hi @daxer-almighty Your code really helped me to solve the issue. Thank you so much.

Now I have a a some string values which I need to calculate average with regions but this measure only works with integers. For eaxmle i  have a value like this below:

Domain1.com -> insecure CMS

Domain4.com -> insecure CMS

Domain8.com -> insecure CMS

I need to show it as a percentage based on Region like 67% domain use insecure CMS

Do you have any idea how to fix it with DAX?

Thanks!

Elshad
Frequent Visitor

This measure works now: 

Region Average SEO =
CALCULATE(
AVERAGE(Table1[SEO] ),
REMOVEFILTERS( 'Table2'[FQDN] ),
KEEPFILTERS( VALUES( 'Table2'[Region Name] ) )
)
Elshad
Frequent Visitor

Thanks @daxer-almighty  for your reply. Current mease does not work.  "The syntax for '[Region Average]' is incorrect". Also Power Bi can not find "[AVG SEO]" 

Can you please give me a bit clear measure? Thank you!

 

 

Hi @Elshad

 

I'd kindly suggest that you carefully look at what I've written and understand it. Because clearly you don't. Then, when you have understood, do it right in PBI and everything will be working fine as it does on my end.

daxer-almighty
Solution Sage
Solution Sage

[Avg SEO] = AVERAGE( T[SEO] )

[Region Average] =
CALCULATE(
    [Avg SEO],
    REMOVEFILTERS( T[Domain] ),
    KEEPFILTERS( VALUES( T[Region Name] ) )
)

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.