The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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