Dear DNA Team,
I will appreciate your explanation regarding one issue that occurred to me but I manage to resolve it.
Data Model:
The above screenshot shows the formula with a slightly different pattern.
I was trying to calculate top customer name for each job category and then the revenue that the customer generated.
In the Pattern 1.
Top Customer Name = MAXX(
TOPN(1,SUMMARIZE(Customer,Customer[Customer Name],“GP”,[P&L GP]),
[GP],DESC),
Customer[Customer Name])
Top Customer Name GP = MAXX(
TOPN(1,SUMMARIZE(Customer,Customer[Customer Name],“GP”,[P&L GP]),
[GP],DESC),
[GP])
But I run into an issue as the above formula brought the customer name for the job category that sales were never generated.
In order to fix this, I wrapped up the formula in a simple if statement:
Top Customer Name v3 = IF(ISBLANK([P&L GP]),BLANK(), MAXX(
TOPN(1,SUMMARIZE(Customer,Customer[Customer Name],“GP”,[P&L GP]),
[GP],DESC),
Customer[Customer Name]))
But then once again I run into an issue
The formula brought incorrect customer name and the sales actually are negative.
To fix it, i replaced customer table with the data table
Top Customer Name v2 = MAXX(
TOPN(1,SUMMARIZE(Data,Customer[Customer Name],“GP”,[P&L GP]),
[GP],DESC),
Customer[Customer Name])
As per the below screen, the results are correct. My question is why the first two formulas didn’t work correctly?
Please find the attached pbi fileTask2.pbix (923.2 KB)
I will appreciate your feedback.
Thank you,
Matty