Forum Discussion
Filter calculation in a measure
Good day All
I need assistance in calculating % of sales, example below
I have sales for 5 Items, however only 3 are on promotion, I am using the filter by list (Devscope) to filter my sales to show only the promo sales in my table, however i want to create a card that shows the % of promo sales vs total sales so simply below
- Anonymous1 year ago
Thank you very much bhanu_gautam for your prompt reply.
For your question, here is the method I provided:
Here's some dummy data
“CapeTown_itemwisesales”
“PromoList”
Add a calculated column in the CapeTown_itemwisesales table to indicate whether an item is on promotion:
IsPromo = IF(RELATED('PromoList'[ItemCode]) <> BLANK(), 1, 0)Create a measure to calculate the total promo sales:
PromoSales = CALCULATE(SUM('CapeTown_itemwisesales'[TotalSales]), 'CapeTown_itemwisesales'[IsPromo] = 1)Create a measure to calculate the total sales:
Measure TotalSales = SUM('CapeTown_itemwisesales'[TotalSales])Create a measure to calculate the percentage of promo sales versus total sales:
PromoSalesPercentage = DIVIDE([PromoSales], [Measure TotalSales], 0)Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- bhanu_gautam
Super User
TaariqHussain , First create a measure for
TotalSales = SUM('CapeTown_itemwisesales'[totalsales])
Assuming you have a column that identifies whether an item is on promotion (e.g., 'CapeTown_itemwisesales'[IsPromo]), you can filter the sales to only include promo items.
PromoSales = CALCULATE(
SUM('CapeTown_itemwisesales'[totalsales]),
'CapeTown_itemwisesales'[IsPromo] = TRUE
)Then PromoSalesPercentage = DIVIDE([PromoSales], [TotalSales], 0)
Add a card visual to your report.
Set the value of the card to the PromoSalesPercentage measure. - TaariqHussain
Helper I
I dont have it in the same sales report, its a completelt different list in which i only have the item codes that are participating in the promo, no sales values, is there a way for me to link the sales data to the promo list so that it can maybe add a column in the sales data for Promos?
- AnonymousNot applicable
Thank you very much bhanu_gautam for your prompt reply.
For your question, here is the method I provided:
Here's some dummy data
“CapeTown_itemwisesales”
“PromoList”
Add a calculated column in the CapeTown_itemwisesales table to indicate whether an item is on promotion:
IsPromo = IF(RELATED('PromoList'[ItemCode]) <> BLANK(), 1, 0)Create a measure to calculate the total promo sales:
PromoSales = CALCULATE(SUM('CapeTown_itemwisesales'[TotalSales]), 'CapeTown_itemwisesales'[IsPromo] = 1)Create a measure to calculate the total sales:
Measure TotalSales = SUM('CapeTown_itemwisesales'[TotalSales])Create a measure to calculate the percentage of promo sales versus total sales:
PromoSalesPercentage = DIVIDE([PromoSales], [Measure TotalSales], 0)Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.