Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
The table is in a direct query mode and the logic i need is
If Both Supplier and User location are in the same continent for the entire business = 1,
if Supplier and Users are in different continents ( 1 user continent) =2
if Supplier and Users are in different continents ( >1 user continent) =3
Solved! Go to Solution.
Please try
=
IF (
HASONEVALUE ( 'Table'[user ID] ),
MAXX (
'Table',
VAR UserContinent = 'Table'[user Continent]
VAR SupplierContinent = 'Table'[supplier Continent]
VAR NumOfUserContinents =
CALCULATE (
DISTINCTCOUNT ( 'Table'[user Continent] ),
ALLEXCEPT ( 'Table', 'Table'[user ID] )
)
RETURN
SWITCH (
TRUE (),
UserContinent = SupplierContinent, 1,
NumOfUserContinents = 1, 2,
3
)
)
)
Please try
=
IF (
HASONEVALUE ( 'Table'[user ID] ),
MAXX (
'Table',
VAR UserContinent = 'Table'[user Continent]
VAR SupplierContinent = 'Table'[supplier Continent]
VAR NumOfUserContinents =
CALCULATE (
DISTINCTCOUNT ( 'Table'[user Continent] ),
ALLEXCEPT ( 'Table', 'Table'[user ID] )
)
RETURN
SWITCH (
TRUE (),
UserContinent = SupplierContinent, 1,
NumOfUserContinents = 1, 2,
3
)
)
)
Worked like a charm! Thanks very much
These are in 2 different tables
If Supplier and Users are in different continents and the user is in just 1 continent then it should be 2
if Supplier and Users are in different continents and the user is in more than 1 continent, then it should be 3
Can you provide with a sample of your data table
Hello you could use switch bit i didnt understand well the 2 and 3
SWITCH(
TRUE(),
'Table'[supplier location] = 'Table'[user location],1,
AND('Table'[supplier location] <> 'Table'[user location],'Table'[users] =1),2,
AND('Table'[supplier location] <> 'Table'[user location],'Table'[users] > 1),3
)
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |