Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Dear Community Members,
I have a product table and a sales table like the below. Both are linked by product.
I have two measures average price and overall average price which is the total sold amt / total qty.
When I display them in the table they come up correctly but as below. Is it possible to define the overall overage price so that it is only calculated for products that have sales against them ?
I have attached the sample pbix file.
Thank you for any suggestions !
Solved! Go to Solution.
Hi @nedpbi
You want only calculated for products that have sales, you just need to add a filter with sales greater than 0.
DAX:
Overall Avg Price for Products with Sales =
CALCULATE(
DIVIDE(SUM(Sales[Amt]), SUM(Sales[Qty])),
FILTER(
Sales,
Sales[Qty] > 0
)
)
Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-jialongy-msftmaybe did not understand correctly, but tried the below and this seems to work. Thanks again for the help !
Hi @nedpbi
You want only calculated for products that have sales, you just need to add a filter with sales greater than 0.
DAX:
Overall Avg Price for Products with Sales =
CALCULATE(
DIVIDE(SUM(Sales[Amt]), SUM(Sales[Qty])),
FILTER(
Sales,
Sales[Qty] > 0
)
)
Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you @v-jialongy-msft for your reply !
When I try the formula above I get the below. I want to see 2.17 repeated along all the rows for all articles (or attribute of article like brand in this case) but only show rows that actually have sales rather than all articles from the master
Thank you !
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
24 | |
22 | |
20 | |
15 | |
10 |