Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello I have been trying to create a new column with the location name of the org. I was abel to write this code:
CTL Location =
@Anonymous
Manually insert the 'Locations' table as follows
| Group code | Office Code | City Code | CTL Location Name |
| 101 | IN1 | IAC | Kolkata AC |
| 103 | NAA | YXU | Canada AC |
| 141 | IN1 | IAC | Kolkata AC |
| 141 | IN1 | TPL | TPL |
| 143 | NAA | YUL | Canada AC |
| 197 | NAA | YYZ | Canada AC |
| 217 | IN1 | BAC | Bangalore AC |
| 224 | IN1 | BAC | Bngalore AC |
| 224 | IN1 | PSD | Poland AC |
| 224 | IN1 | SAC | Shanghai AC |
| 225 | IN1 | IAC | Kolkata AC |
| 225 | IN1 | BAC | Bangalore AC |
| 225 | IN1 | SAC | Shanghai AC |
| 230 | IN1 | BAC | Bangalore AC |
| 230 | IN1 | IAC | Kolkata AC |
| 231 | IN1 | BAC | Bangalore AC |
| 233 | NAC | OAK | Canada AC |
| 233 | NAC | YYC | Canada AC |
| 233 | NAC | YXU | Canada AC |
| 233 | NAC | TPL | Canada AC |
| 233 | NAC | YKF | Canada AC |
| 233 | NAC | YKZ | Canada AC |
| 233 | NAC | YNJ | Canada AC |
| 233 | NAC | YOW | Canada AC |
| 233 | NAC | YQG | Canada AC |
| 233 | NAC | YUL | Canada AC |
| 233 | NAC | YVR | Canada AC |
| 233 | NAC | YYZ | Canada AC |
| 233 | NAC | YWG | Canada AC |
| 240 | IN1 | IAC | Kolkata AC |
| 242 | IN1 | BAC | Bangalore AC |
| 243 | IN1 | IAC | Kolkata AC |
| 243 | IN1 | BAC | Bangalore AC |
| 244 | IN1 | IAC | Kolkata AC |
| 244 | IN1 | BAC | Bangalore AC |
| 244 | IN1 | SAC | Shanghai AC |
| 245 | IN1 | BAC | Kolkata AC |
| 245 | IN1 | IAC | Bangalore AC |
| 246 | IN1 | IAC | Kolkata AC |
| 255 | IN1 | IAC | Kolkata |
| 255 | IN1 | TPL | TPL |
| 612 | IN1 | IAC | Kolkata |
| 612 | IN1 | TPL | TPL |
| 817 | NAC | OAK | Canada AC |
| 817 | NAC | YYC | Canada AC |
| 817 | NAC | YXU | Canada AC |
| 817 | NAC | TPL | Canada AC |
| 817 | NAC | YKF | Canada AC |
| 817 | NAC | YKZ | Canada AC |
| 817 | NAC | YNJ | Canada AC |
| 817 | NAC | YOW | Canada AC |
| 817 | NAC | YQG | Canada AC |
| 817 | NAC | YUL | Canada AC |
| 817 | NAC | YVR | Canada AC |
| 817 | NAC | YYZ | Canada AC |
| 817 | NAC | YWG | Canada AC |
| 835 | NTX | YKF | Canada AC |
| 835 | NTX | YXU | Canada AC |
| 835 | NTX | YYZ | Canada AC |
The calculated column would be
CTL Location =
MAXX (
FILTER (
Locations,
Locations[Group Code] = 'IP_Current_Staff'[chCurrGroupCode]
&& Locations[City Code] = 'IP_Current_Staff'[chCityCode]
&& Locations[Office Code] = 'IP_Current_Staff'[chCurrOfficeCode]
),
Locations[CTL Location Name]
)
I wont be able to manually enter this as it is directly querried from a SQL database which i dont have access to. Plus I want to use it for a slicer dropdown
@Anonymous
You can be at direct query mode and yet you can have a direct import table. However, you may also ask the data owner to include this table with the data set. Otherwise it would be a DAX code of multiple pages! I don't think you want that, do you?
What slicer do you want to use?
@Anonymous
These three columns
'IP_Current_Staff'[chCurrGroupCode], 'IP_Current_Staff'[chCurrOfficeCode] and 'IP_Current_Staff'[chCityCode]
I attached images
@Anonymous
That requires working on the laptop. I'll work out something tomorrow morning. Can you provide editable version of the same? You can just copy/paste the values in a reply.
there is going to be multiple locations, so how should I code for different locations ?
@Anonymous
Do you have a list of each location and it's three column values?
The locations are :
Bangalore AC, Kolkata AC, Canada AC, Shanghai AC, Poland AC.
also which 3 column view ?
@Anonymous
what are the associated values of the three columns for each of these locations?
The data type is Integer value
Hi @Anonymous
What is the data type of the 'IP_Current_Staff'[chCurrGroupCode] column?
However, this should work regardless of the data type
CTL Location =
SWITCH (
TRUE (),
'IP_Current_Staff'[chCurrGroupCode] & 'IP_Current_Staff'[chCurrOfficeCode] & 'IP_Current_Staff'[chCityCode]
IN { "123NAAYXU", "456NAAYUL", "789NAAYYZ", "234NTXYKF" }, "Canada AC",
"Local Offcice"
)
When I run this it shows CONTAINSROW in directquery is not allowed
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |