Forum Discussion
ankbaner
1 year agoRegular Visitor
TOPN DAX function Issue
Dear Power BI community , I am trying to solve a problem related to TOPN DAX function. I want to show list of top 3 products based on their net sales. When I represents products and respective...
- 1 year ago
Hi ankbaner -You're absolutely right to observe the discrepancy
TopN Net Sales =
VAR TopProducts =
TOPN(
3,
ADDCOLUMNS(
VALUES(Sales[ProductKey]),
"NetSales", CALCULATE(SUM(InternetSales[SalesAmount]))
),
[NetSales], DESC
)
RETURN
SUMX(
TopProducts,
[NetSales]
)Hope this works.
rajendraongole1
Super User
1 year agoHi ankbaner -You're absolutely right to observe the discrepancy
TopN Net Sales =
VAR TopProducts =
TOPN(
3,
ADDCOLUMNS(
VALUES(Sales[ProductKey]),
"NetSales", CALCULATE(SUM(InternetSales[SalesAmount]))
),
[NetSales], DESC
)
RETURN
SUMX(
TopProducts,
[NetSales]
)
Hope this works.
- ankbaner1 year agoRegular Visitor
Hi,
Thank you for contributing to create solution. The given formula did not help to get the actual result. The outcome of the formula still shows difference compared to Top n Filter