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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.