Forum Discussion
TopN - Rows increase when adding a column
- 2 years ago
Thank you for your reply.
Unfourtunatly it does not work. I cannot add a column from another table with ADDCOLUMNS, I need to have a measure for the new column.
I fixed the issue by creating a new calculated table which is taking only the relevant columns for the calculations and grouping. Then, I created some measures for the calcualtions.
It's not an efficiendt way but it works (I was hoping to do everything in one measure by leveraging the VARIABLES)
Hi artur4 ,
Based on the description, please try the following dax formula.
Top5CustomersCategories =
VAR CustomerTable =
ADDCOLUMNS(
SUMMARIZE(
FILTER(ALLSELECTED('DATA'[Customer Name]), [GM% vs Country AVG] < 0),
'DATA'[Customer Name],
"DeltaGM", [DeltaGM]
),
"Category", 'DATA'[Category]
)
RETURN
TOPN(5, CustomerTable, [DeltaGM], DESC)
If the above ones can’t help you get it working, could you please provide more raw data(exclude sensitive data) with Text format to make a deep troubleshooting? It would be helpful to find out the solution.
How to provide sample data in the Power BI Forum
Best Regards,
Wisodm Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.