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
Hello, I'm really new and inexperienced with DAX and PowerBI
I'm trying to Sum/Count a certain field in the row level, but my Sum/Count only displays the total of everything, repeating for every row of my Table, i.e:
TABLE 01 = "LIKES"
ID_POST | ID_LIKE | ID_USER |
1523 | 1000 | 0001 |
1523 | 1023 | 0002 |
1222 | 1923 | 0001 |
1222 | 2311 | 0003 |
1523 | 4223 | 0004 |
TABLE 02 = "POSTS"
POST_DATE | POST_ID | POST_CONTENT |
07/10/2022 | 1523 | This is a example post... |
08/10/2022 | 1222 | Example Post number 2... |
TABLE 03 = "USERS" -> EXPECTED RESULT
USER_ID | USER_NAME | COUNT/SUM_LIKES |
01 | NAME01 | 2 |
02 | NAME02 | 1 |
03 | NAME03 | 1 |
04 | NAME04 | 1 |
What I'm getting ->
USER_ID | USER_NAME | COUNT/SUM_LIKES |
01 | NAME01 | 5 |
02 | NAME02 | 5 |
03 | NAME03 | 5 |
04 | NAME04 | 5 |
I don't now how to make the sum per user, the only thing I get is the total of everything..
Can anyone give me a hand?
Solved! Go to Solution.
You likely didn't wire your data model. Should look something like this (although this is questionable as posts have to be done by users too, no?)
Hi @Aldimar_Junior ,
According to your description, I reproduce your problem.
When the two tables don't have relationship, if you select count the column, it will count all the rows, it's correct. If you select summarize, you will find the visual broken.
But your USER_ID (eg 01) in USERS table and ID_USER(eg 0001) in LIKES table are not in the same format, after create relationship, it still can't recognize.
Here's my solution. Don't make relationship and create a measure.
Count =
COUNTROWS (
FILTER (
'LIKES',
CONTAINSSTRING ( 'LIKES'[ID_USER], MAX ( 'USERS'[USER_ID] ) )
)
)
Get the result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You likely didn't wire your data model. Should look something like this (although this is questionable as posts have to be done by users too, no?)
It was indeed a relationship problem, thanks for that!!
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 |
---|---|
134 | |
91 | |
89 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |