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
Anonymous
Not applicable

Filters not working in newly created measure

Hi ,

I am trying to find overlapping sales between 2 branches, want to identify how many customers have bought products from both the branches .For that I have created below measure 

 

1.Branch A_W&C =

CALCULATE(
    [Total Sales],
    FILTER(
        'Product Categories',
        'Product Categories'[Product_category_Level1_EN] = "04 - WIRE & CABLE"
    ),
    Customers[Branch Name] = "A"
)
 
2.Branch B_W&C =
CALCULATE(
    [Total Sales],
    FILTER(
        'Product Categories',
        'Product Categories'[Product_category_Level1_EN] = "04 - WIRE & CABLE"
    ),
    Customers[Branch Name] = "B"
)
 
 I have also created a measure called shared status to identify overlapping sales
 
SharedStatus =
VAR DUNSID = MAX('Customer Groups'[DUNS #])
VAR A =
    CALCULATE(
        COUNTROWS(Sales),
        'Customer Groups'[DUNS #] = DUNSID,
    Customers[Company Name] = "A"
    )
VAR TEXCANWEST =
    CALCULATE(
        COUNTROWS(Sales),
        'Customer Groups'[DUNS #] = DUNSID,
        Customers[Company Name] = "B"
    )
RETURN
    IF(
        A> 0 && B > 0,
        "SHARED",
        "NONSHARED"
    )
 
When I simply drag the total sales  , branches A and B from the table and filter shared  status as "Shared"
Ankit_G_0-1688585890733.pngAnkit_G_3-1688586721212.png

 

 

But when I use the measures, there is a descrepency in the data 

 

Ankit_G_1-1688586237572.png

 

 

However if I select the category then the output is correct 

Ankit_G_2-1688586351618.png
 
Not sure what is the issue,Could you please advice me what I'm doing wrong and how to get the correct results.
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

To get a count of DUNS# which bought from both stores, these measures should work

S of A = CALCULATE([Total Sales],'Product Categories'[Product_category_Level1_EN] = "04 - WIRE & CABLE",Customers[Branch Name] = "A")
S of B = CALCULATE([Total Sales],'Product Categories'[Product_category_Level1_EN] = "04 - WIRE & CABLE",Customers[Branch Name] = "B")
Common = countrows(filter(values('Customer Groups'[DUNS #])),[S of A]>0&&[S of B]>0)
Drag the Common measure to a card visual.

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Ashish_Mathur  thanks Ashish for providing me with the solution , I am also looking to calculate overlapping sales  by branch i.e  sales fo branch A and sales branch B and total sales .

along with  count of non shared customers by branch and their sales.

BranchSales Shared# Customer SharedNon- Shared Sales# Non- Shared Customer
A$847$ 
B$847$ 

 

Since I am working on overlapping sales is it  possibel to create a dynamic shared measure "Common" where I will filter the branches and it will show me the results?

You are welcome.  Not clear about your request at all.  Share some data and show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

To get a count of DUNS# which bought from both stores, these measures should work

S of A = CALCULATE([Total Sales],'Product Categories'[Product_category_Level1_EN] = "04 - WIRE & CABLE",Customers[Branch Name] = "A")
S of B = CALCULATE([Total Sales],'Product Categories'[Product_category_Level1_EN] = "04 - WIRE & CABLE",Customers[Branch Name] = "B")
Common = countrows(filter(values('Customer Groups'[DUNS #])),[S of A]>0&&[S of B]>0)
Drag the Common measure to a card visual.

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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