Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi there,
I'm looking for help to calculate a "status" column where Allairport value is not in source or destination. Its a flat table. For similicity just represented the sample PBI data as below.
You could see G is not found anywhere in source or destination.
In SQL world, query would be something like below
UPDATE TABLE
SET AllAirports = 'Found'
where AllAirports in
(
select distinct source as a from table
union
select distinct destination from table
)
UPDATE TABLE
SET AllAirports = 'Not Found'
where AllAirports not in
(
select distinct source as a from table
union
select distinct destination from table
)
Thanks
Solved! Go to Solution.
@Anonymous ,
Try this,
Status =
VAR _col1 = DISTINCT('Table'[Source])
VAR _col2 = DISTINCT('Table'[Destination])
VAR _union = UNION(_col1,_col2)
VAR _result = IF('Table'[AllAirports] IN _union,"Found","Not Found")
RETURN _result
Thanks,
Arul
@Anonymous ,
try this in calculated column,
Status = IF('Table'[AllAirports] = 'Table'[Source] || 'Table'[AllAirports] = 'Table'[Destination],"Found","Not Found")
Thanks,
Arul
Thanks. I'm afraid it didnt work by just comparing 1 row alone. The value should be searched on all the rows of source and destination and then compute if it is found or not found. In this case E is found.
@Anonymous ,
Try this,
Status =
VAR _col1 = DISTINCT('Table'[Source])
VAR _col2 = DISTINCT('Table'[Destination])
VAR _union = UNION(_col1,_col2)
VAR _result = IF('Table'[AllAirports] IN _union,"Found","Not Found")
RETURN _result
Thanks,
Arul
is there a way to use where / filter condition along with distinct. Something like this
VAR _col1 = DISTINCT('Table'[Source]), Filter('Table',len(Table[SomeotherColum])> 0) -- this is not working. I'm trying to add distinct source with where condition.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |