Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi all,
I have a table that is unique on ID, and another that is not. I need to create a measure to flag those IDs that appear in the other table with a condition. Let Friends be
ID | Name |
1 | Ben |
2 | Jerry |
3 | Ruth |
4 | Lesley |
Let FriendFamily be
ID | FamilyMember |
1 | kid* |
1 | pet |
1 | partner |
2 | kid |
2 | kid |
2 | kid |
3 | pet |
4 | pet |
4 | partner |
*human not goat
The tables are connected on ID (one to many). I would like a measure that flags each ID in Friends based on whether or not they have a pet. The tables are in a database, Direct Query is my only option (the real tables are massive). So far I've tried DISTINCTCOUNT in FriendFamily, with which I got to a point where I could have a table visual with 3 columns: ID, has_pet, has_human, but then I got lost in trying to figure out how to create calculations with this information. It wouldn't work as a filter for instance, when I tried to apply it to a card that showed distinct count on ID. The business requirements are:
The measures I've managed to build are below.
ID | Name | (measure)HasPet | (measure)HasHuman | (measure)HasBoth | (measure)FamilyType |
1 | Ben | 1 | 1 | 1 | Has Both |
2 | Jerry | 0 | 1 | 0 | Only Human |
3 | Ruth | 1 | 0 | 0 | Only Pet |
4 | Lesley | 1 | 1 | 1 | Has Both |
Solved! Go to Solution.
Hi,
Drag ID from the Friends table and drag this measure to the visual
Family members = if(DISTINCTCOUNT(FriendFamily[FamilyMember])=1,if(MAX(FriendFamily[FamilyMember])="kid","Only human","Only pet"),"Has Both")
Hope this helps.
Hi,
Drag ID from the Friends table and drag this measure to the visual
Family members = if(DISTINCTCOUNT(FriendFamily[FamilyMember])=1,if(MAX(FriendFamily[FamilyMember])="kid","Only human","Only pet"),"Has Both")
Hope this helps.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
85 | |
65 | |
51 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |