March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
86 | |
77 | |
57 | |
52 |
User | Count |
---|---|
201 | |
137 | |
108 | |
73 | |
68 |