Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello Everyone,
I've 2 tables ;
Product Dimension Table:
Product Name - Product Category - Product Sub Category
Bike Sporting Goods Cycling
Helmet Sporting Goods Cycling
Soccer Ball Sporting Goods Soccer
Jacket Apparel Outerwear ,
Product Name (for reference) - Sales
Bike 100
Helmet 10
Soccer Ball 5
Jacket 25 .
I'm trying to get the Category and Sub Category Sales as measures for comparison, so it would be like below:
Product Name Product Sales Sub Category Sales Category Sales
Bike 100 110 115
Helmet 10 110 115
Soccer Ball 5 5 115
Jacket 25 25 25
I used:
Solved! Go to Solution.
Hi again,
You need to creat a measure not a calculated column:
SubCategory Sales =
var _subcategory = SELECTEDVALUE('Table'[Prod Sub Category])
var _value =
CALCULATE(
sum('Table'[tab2.sales]),
filter (ALL('Table'), 'Table'[Prod Sub Category]= _subcategory)
)
return
_value
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Hello ENGFAKAYODE
Try this solution:
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
I just tried it
hi again
change in line 8 :
... product sub category] in CurrentSubcategory
you are using the function "values" in the fisrt var so you will have muliples values.
another way is to change Values to Selectedvalue
try please
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
The columns are blank
Hi again,
You need to creat a measure not a calculated column:
SubCategory Sales =
var _subcategory = SELECTEDVALUE('Table'[Prod Sub Category])
var _value =
CALCULATE(
sum('Table'[tab2.sales]),
filter (ALL('Table'), 'Table'[Prod Sub Category]= _subcategory)
)
return
_value
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Thanks
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 37 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |