Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi,
I made a dashboard that measures several metrics of a certain animal-related company. A problem is that the data comes in quite messy so to get my filters to work I have to register all data into a combined Query. Not really a problem normally but since I want to count both the number of users and the number of pets it is one now. The thing is, one user ID has several pet ID's linked to it, which in turn gives double values. Normally you would delete those but if I do that it deletes all pets but one. So at the moment, It looks like this for example:
through the index, it can only count the number of pets but not the user.
So I am kinda looking for a function similar to: IF [user_id] IS 'DUBBLE.VALUE' THEN [index] IS 'ZERO' so it will only count the users one time while still counting all the pets.
I've been looking for days but cannot find the answer anywhere online or offline so maybe somebody has a solution here?
Solved! Go to Solution.
You can try this in blank query.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXLWc8pJzMsGspL1kkAsh/zSkpz8/Gy95PxcoKihoZkBkHLJTweSbplpICGlWB2iNYOVJZYASaf8osxiUrUbwe32TayAawaJBugFl2eCVBUDKXSNxkYgRwclJmWCbHbLKU0jRS/IbcEZqakFIFcXVcK1GgNZjnq+UH8k6uXmO6TnJmbmwHSaGCGc61iUCNEXCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"User ID" = _t, User = _t, Email = _t, Pet = _t, Sort = _t, Name = _t, Index = _t]),
#"Grouped Rows" = Table.Group(Source, {"User ID"}, {{"Gr", each Table.AddColumn(Table.AddIndexColumn(_,"Help", 0,1), "Index2", each if [Help]=0 then 1 else 0)}}),
#"Expanded Gr" = Table.ExpandTableColumn(#"Grouped Rows", "Gr", {"User", "Email", "Pet", "Sort", "Name", "Index", "Index2"}, {"User", "Email", "Pet", "Sort", "Name", "Index", "Index2"})
in
#"Expanded Gr"
Hi @Anonymous
@Jakinta 's solution looks great. Does it solve your problem? If it's not what you want, could you show what should be the expected result in Index column (or a new column)?
Regards,
Community Support Team _ Jing
You can try this in blank query.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXLWc8pJzMsGspL1kkAsh/zSkpz8/Gy95PxcoKihoZkBkHLJTweSbplpICGlWB2iNYOVJZYASaf8osxiUrUbwe32TayAawaJBugFl2eCVBUDKXSNxkYgRwclJmWCbHbLKU0jRS/IbcEZqakFIFcXVcK1GgNZjnq+UH8k6uXmO6TnJmbmwHSaGCGc61iUCNEXCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"User ID" = _t, User = _t, Email = _t, Pet = _t, Sort = _t, Name = _t, Index = _t]),
#"Grouped Rows" = Table.Group(Source, {"User ID"}, {{"Gr", each Table.AddColumn(Table.AddIndexColumn(_,"Help", 0,1), "Index2", each if [Help]=0 then 1 else 0)}}),
#"Expanded Gr" = Table.ExpandTableColumn(#"Grouped Rows", "Gr", {"User", "Email", "Pet", "Sort", "Name", "Index", "Index2"}, {"User", "Email", "Pet", "Sort", "Name", "Index", "Index2"})
in
#"Expanded Gr"
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |