Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello Everyone
I need to create a Calculated Column to flag my company's clients.
Algorithm is simple but tricky:
ClientId | Provider | Flag |
Jhon | MyCompany | SharedClient |
Jhon | Provider02 | SharedClient |
Jhon | Provider17 | SharedClient |
Luis | Provider11 | NotMyClient |
Luis | Provider03 | NotMyClient |
Carlos | MyCompany | ExclusiveClient |
Pedro | Provider16 | SharedClient |
Pedro | MyCompany | SharedClient |
Last but not least, I cant use row count because we have the same information for all months of the year in the same table
Any suggestions about how to create the Calculated Column.
Rewards.
Solved! Go to Solution.
@AvalBuroAdmin That's why I used SUMMARIZE.
@AvalBuroAdmin , As a new column
new column =
var _mycomp = countx(filter(Table,[ClientId] =earlier([ClientId]) && [Provider] ="MyCompany"),[ClientId])+0
var _ocomp = countx(filter(Table,[ClientId] =earlier([ClientId]) && [Provider] <> "MyCompany"),[ClientId])+0
return
Switch() ( True() ,
_mycomp>0 && _ocomp =0 , "ExclusiveClient",
_mycomp>0 && _ocomp >0 ,"SharedClient",
"NotMyClient"
)
@AvalBuroAdmin - Maybe:
Flag =
VAR __Table = SELECTCOLUMNS(SUMMARIZE(FILTER('Table',[ClientId]=EARLIER([ClientId])),[Provider]),"Count",COUNTROWS('Table'),"Provider",[Provider])
RETURN
SWITCH(
COUNTROWS(__Table)=1 && "MyCompany" IN DISTINCT(__Table),"ExclusiveClient",
"MyCompany" IN DISTINCT(__Table),"SharedClient",
"NotMyClient"
)
@Greg_Decklerthe problem is I can have more than 1 row with the same client and provider because in the same table same data is detailed for every month of the year (and others columns). Is there a way to create the flag without counting rows or calcluate this column in power query editor?
@AvalBuroAdmin That's why I used SUMMARIZE.
User | Count |
---|---|
11 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
25 | |
19 | |
16 | |
10 | |
7 |