Forum Discussion
TOPN and segments
It seems like you're facing a challenge in creating a measure that calculates the total sales for the top 10 clients based on user-selected segments, including firm, activity, year, and month. The issue is that your current measure doesn't respond to changes in the selected month.
To address this, you can modify your measure to include filters based on user selections. Assuming you have a date column in your "BDD GESSI" table, you can adjust your measure like this:
TOP10 CA =
SUMX(
TOPN(10, 'BDD GESSI', [Sales amount (GESSI - summarize)], DESC),
CALCULATE(
[Sales amount (GESSI - summarize)],
ALL('BDD GESSI'),
VALUES('BDD GESSI'[Firms]),
VALUES('BDD GESSI'[activity]),
VALUES('BDD GESSI'[year]),
VALUES('BDD GESSI'[month]) // Add this line to consider the selected month
)
)
In this modified measure, I've used the CALCULATE function with the ALL function to remove any existing filters on the 'BDD GESSI' table. Then, I've added filters based on the selected firm, activity, year, and month using the VALUES function for each corresponding column.
This should enable your measure to dynamically adjust based on the user's selections for the month. If your date column contains both year and month information, you can adapt the code accordingly.
Remember to replace 'Firms', 'activity', 'year', and 'month' with the actual column names from your "BDD GESSI" table.
Try implementing these changes and see if it resolves your issue. If you encounter any further challenges or if your data model has specific complexities, feel free to provide more details for additional assistance.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.