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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Iyin
New Member

Error while using the column chart to compare a single merchant with others with same merchant code

I'm trying to compare a Merchant that has similar Merchant Codes. I have for instance 'Daffodils Clothing Store' and 'Metro Clothing Store' having the same Merchant code. What I want is that when I select either of these two it will display the selected merchant versus a sum of the two merchant of similar code. This is not the case from my visual as the others just displays the same value of my selected merchant. Can someone help me out?

Below is the code I wrote:

Merchant Vs Others =
VAR CurrentMerchant = MAX('Merchants + Others'[Merchant Name])
VAR SelectedMerchant = ALLSELECTED('Sample payment data'[Merchant Name])
RETURN
SWITCH(
    TRUE(),
    CurrentMerchant IN SelectedMerchant,
    CALCULATE([Sum of Revenue], 'Sample payment data'[Merchant Name] = CurrentMerchant),
    CurrentMerchant = "Others",
    CALCULATE( [Sum of Revenue],
   ALL('Sample payment data'[Merchant Category Code])))
 
Iyin_0-1698763293576.png

Visual before selection

 

Iyin_2-1698763454732.png

 


Visual after selection

1 REPLY 1
Anonymous
Not applicable

Hi @Iyin ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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