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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Subcategory Net sales

Hi Power BI Users,

 

I am having Category1, category 2 and sales in my Table as below. I want net sales for category 2 excluding category. All dax is giving misccelaneous output. Can you guys help here.

Sub cateogry  sales.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below to get the category Net sales, please find the details in the attachment.

Category Net sales = 
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[Category],
        "@ssales", CALCULATE ( SUM ( 'Table'[sales] ), ALLEXCEPT ( 'Table', 'Table'[Category] ) )
    )
RETURN
    SUMX ( _tab, [@ssales] )

yingyinr_0-1646734134172.png

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below to get the category Net sales, please find the details in the attachment.

Category Net sales = 
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[Category],
        "@ssales", CALCULATE ( SUM ( 'Table'[sales] ), ALLEXCEPT ( 'Table', 'Table'[Category] ) )
    )
RETURN
    SUMX ( _tab, [@ssales] )

yingyinr_0-1646734134172.png

Best Regards

TheoC
Super User
Super User

Hi @Anonymous 

 

You can calculate the subtotal by a category by using the following:

 

Category Sales = CALCULATE ( SUM ( 'Table'[Sales] ) , ALLEXCEPT ( 'Table'[Category] ) )

 

Hope this helps.

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.