Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hey guys,
I am currently trying to create a calculated column as in my customer master data returning a string based on the highest revenue from the sales data. Say, customer A buys from sales manager X for 10 € and from sales manager Y 20 €, I would like to return "sales manager Y". I tried doing this with SUMMARIZE in a DAX measure, because I do not want to create a slave table.
I tried the following:
MyCalcColumn=
Customer | Sales manager | Net |
A | X | 10 |
A | Y | 20 |
B | Z | 30 |
Customer data:
Customer |
A |
B |
Desired customer data incl. calculated column:
Customer | MyCalcColumn |
A | Y |
B | Z |
Thanks and best
T
Solved! Go to Solution.
Not by a computer however... I think the issue is you're not forcing a context transition. Eg it's not taking account of the current row.
As a starting point wrap your summarise in CALCULATETABLE ( Your summarise statement )
You might want to try solving the problem as follows below which would also deal with cases where there is a tie.
MyCalcColumn =
//Find highest net value related to customer. Note that RELATEDTABLE automatically forces a context transition.
VAR MaxNet = MAXX ( RELATEDTABLE ( 'Sales Lines' ), 'Sales Lines'[Net] )
//Retrieve a table of all sales managers related to customer who achieved this highest net value.
VAR tblBestSalesManagers =
CALCULATETABLE (
VALUES ( 'Sales Lines'[Sales manager] ),
'Sales Lines'[Net] = MaxNet
)
//Concatenate rows of the table together to deal with cases where there is a tie.
VAR BestSalesManager =
CONCATENATEX ( tblBestSalesManagers, [Sales manager], ", " )
RETURN BestSalesManager
Not by a computer however... I think the issue is you're not forcing a context transition. Eg it's not taking account of the current row.
As a starting point wrap your summarise in CALCULATETABLE ( Your summarise statement )
Perf, works...
Life can be so easy 🙂
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
64 | |
60 | |
51 | |
36 | |
36 |
User | Count |
---|---|
81 | |
72 | |
58 | |
45 | |
44 |