Forum Discussion
Anonymous
4 years agoNot 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.
- Anonymous4 years ago
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] )Best Regards
2 Replies
- TheoCCommunity Champion
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
- AnonymousNot 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] )Best Regards