Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hey everyone, I have my table one, who look like this :
Location | X | Y |
Location_1 | A | B |
Location_1 | B | C |
Location_2 | A | C |
Location_4 | C | A |
... | ... | ... |
I've created another table manually to which I'd like to add the count of each note by Location in another column, but I can't manage to code it in DAX to do this, can someone help me?
Expected output :
Location | Rank | Count_X | Count_Y |
Location_1 | A | 56 | 10 |
Location_2 | A | 38 | 16 |
Location_3 | A | 23 | 63 |
Location_4 | A | 12 | 65 |
Location_1 | B | 75 | 26 |
Location_2 | B | 83 | 37 |
Location_3 | B | 94 | 74 |
Location_4 | B | 35 | 73 |
Location_1 | C | 64 | 15 |
Location_2 | C | 194 | 64 |
Location_3 | C | 285 | 25 |
Location_4 | C | 186 | 241 |
(All numbers are here for example)
Thanks all for any help !
Solved! Go to Solution.
Unpivot your "Table one" to bring it into usable format.
Then you can use implicit measures to achieve your result, no need for DAX.
Hi @Anonymous
@lbendlin Thank you very much for your prompt reply, and allow me to add something here.
As @lbendlin mentioned, you need to do unpivot columns for column "X" and column "Y" and then do the calculations.
Here's some dummy data
“Table”
Select two columns in the power query and click unpivot columns.
Create measures.
Count_Y =
CALCULATE(
COUNTROWS('Table'),
FILTER(
ALL('Table'),
'Table'[Location] = MAX('Table'[Location])
&&
'Table'[Attribute] = "Y"
&&
'Table'[Rank] = MAX('Table'[Rank])
)
)
Count_X =
CALCULATE(
COUNTROWS('Table'),
FILTER(
ALL('Table'),
'Table'[Location] = MAX('Table'[Location])
&&
'Table'[Attribute] = "X"
&&
'Table'[Rank] = MAX('Table'[Rank])
)
)
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
@lbendlin Thank you very much for your prompt reply, and allow me to add something here.
As @lbendlin mentioned, you need to do unpivot columns for column "X" and column "Y" and then do the calculations.
Here's some dummy data
“Table”
Select two columns in the power query and click unpivot columns.
Create measures.
Count_Y =
CALCULATE(
COUNTROWS('Table'),
FILTER(
ALL('Table'),
'Table'[Location] = MAX('Table'[Location])
&&
'Table'[Attribute] = "Y"
&&
'Table'[Rank] = MAX('Table'[Rank])
)
)
Count_X =
CALCULATE(
COUNTROWS('Table'),
FILTER(
ALL('Table'),
'Table'[Location] = MAX('Table'[Location])
&&
'Table'[Attribute] = "X"
&&
'Table'[Rank] = MAX('Table'[Rank])
)
)
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Unpivot your "Table one" to bring it into usable format.
Then you can use implicit measures to achieve your result, no need for DAX.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
9 |