Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
18 | |
15 | |
14 | |
11 | |
8 |
User | Count |
---|---|
24 | |
19 | |
12 | |
11 | |
10 |