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! Learn more

Reply
maximennella
New Member

How to calculate this measure? (Easy question)

I have these two tables in my model:

 

Product_id      Sales

       A              $100

       B              $400

       C              $300

       A              $500

 

Product_id        Category

       A                  Telco

       B                  Telco

       C                 Mobile

 

 

I need to do a measure that adds all the sales that are Telco. Can I do this? What would be the DAX?

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @maximennella ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can achieve it by the following 2 methods:

1. Create a relationship between these two tables base on Product_id, then create a measure just as suggested by @ryan_mayu

yingyinr_0-1630377181291.png

Measure = 
VAR _products =
    CALCULATETABLE (
        VALUES ( 'Category'[Product_id] ),
        FILTER ( 'Category', 'Category'[Category] = "Telco" )
    )
RETURN
    CALCULATE (
        SUM ( 'Sales'[Sales] ),
        FILTER ( 'Sales', 'Sales'[Product_id] IN _products )
    )

yingyinr_1-1630377266446.png

2. Create a slicer using Category field after the relationship be created between these two tables just as shown in below screenshot. You don't need to create any measure here, and you can switch the category dynamically to view the sum of sales base on selected category option.

yingyinr_2-1630377288725.png

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @maximennella ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can achieve it by the following 2 methods:

1. Create a relationship between these two tables base on Product_id, then create a measure just as suggested by @ryan_mayu

yingyinr_0-1630377181291.png

Measure = 
VAR _products =
    CALCULATETABLE (
        VALUES ( 'Category'[Product_id] ),
        FILTER ( 'Category', 'Category'[Category] = "Telco" )
    )
RETURN
    CALCULATE (
        SUM ( 'Sales'[Sales] ),
        FILTER ( 'Sales', 'Sales'[Product_id] IN _products )
    )

yingyinr_1-1630377266446.png

2. Create a slicer using Category field after the relationship be created between these two tables just as shown in below screenshot. You don't need to create any measure here, and you can switch the category dynamically to view the sum of sales base on selected category option.

yingyinr_2-1630377288725.png

Best Regards

ryan_mayu
Super User
Super User

@maximennella 

create relationship between two tables and create a measure

test = CALCULATE(sum('Table (2)'[Sales]),FILTER('Table (3)','Table (3)'[Category]="Telco"))




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

Top Solution Authors