Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi All,
I am having trouble with a query. I want to identify all rows if 1 row matches a condition. e.g my table looks like below:
ID | Type |
1 | Home Care |
1 | Direct Payment |
2 | Day Care |
2 | Residential |
2 | Direct Payment |
3 | Home Care |
3 | Day Care |
3 | Residential |
3 | Supported Living |
4 | Direct Payment |
4 | Day Care |
I want to highlight or select or rows where type = Residential therefore the output should look like below:
ID | Type | Yes/No |
1 | Home Care | No |
1 | Direct Payment | No |
2 | Day Care | Yes |
2 | Residential | Yes |
2 | Direct Payment | Yes |
3 | Home Care | Yes |
3 | Day Care | Yes |
3 | Residential | Yes |
3 | Supported Living | Yes |
4 | Direct Payment | No |
4 | Day Care | No |
So all matching id's will have yes if 1 row matches where type = Residential.
is this possible to do? i have searched in google but cannot find a solution to my query.
kind regards
Hetal
Solved! Go to Solution.
Hi @Anonymous
NewCol =
VAR list_ = CALCULATETABLE(DISTINCT(Table1[Type]), ALLEXCEPT(Table1, Table1[ID]))
VAR soughtType_ = "Residential"
RETURN
IF ( soughtType_ IN list_, "Yes", "No" )
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Thank you very much. it works as expected.
kind regards
Hetal
Hi @Anonymous
NewCol =
VAR list_ = CALCULATETABLE(DISTINCT(Table1[Type]), ALLEXCEPT(Table1, Table1[ID]))
VAR soughtType_ = "Residential"
RETURN
IF ( soughtType_ IN list_, "Yes", "No" )
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
i need to tweak the formula slightly. if the residential has ended before end of the month the it needs to show No. is this posssible?
@Anonymous
Where are the dates? Please provide as data sample with all the relevant fields and show the expected result for the sample
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
i am getting error message about 'post flooding detected'.
using the same table, ID 2 and where the type is Residential has an end date of 24/4/2021 therefore i need the Yes/No column to show as No.
is this possible?
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
83 | |
82 | |
65 | |
49 |
User | Count |
---|---|
135 | |
111 | |
100 | |
65 | |
62 |