Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello,
I'm struggling with trying to do something in DAX that's very easy in Power Query, however I need to do it in DAX.
Basically, I have a table like below:
COL1 | COL2 |
AAA | 123 |
AAA | 456 |
BBB | 789 |
I want to do a distinct based just on COL1, so the output I'm looking for is
COL1 | COL2 |
AAA | 123 |
BBB | 789 |
I tried using different combinations of FILTER, CALCULATETABLE, and DISTINCT, but everything I've tried is giving me errors.
Thank you in advance to anyone who can help!
Solved! Go to Solution.
Hi @Anthony_G1
If you need to return a table then try this.
Table 2 =
ADDCOLUMNS(
VALUES( 'Table'[COL1] ),
"COL2", CALCULATE( MIN( 'Table'[COL2] ) )
)
Hi @Anthony_G1
If you need to return a table then try this.
Table 2 =
ADDCOLUMNS(
VALUES( 'Table'[COL1] ),
"COL2", CALCULATE( MIN( 'Table'[COL2] ) )
)
Thank you Mariusz. I apologize but I should have used a better example. My table actually has five columns, and I tried extrapolating the answer you provided to generate a table that has more than the two columns but I'm unable to.
So if Table 1 has
COL1 | COL2 | COL3 | COL4 | COL5 |
AAA | 123 | qwerty | yti | poui |
AAA | 456 | asdf | fghj | lkjh |
BBB | 789 | zxcv | cvbn | mnbv |
How can I get:
COL1 | COL2 | COL3 | COL4 | COL5 |
AAA | 123 | qwerty | yti | poui |
BBB | 789 | zxcv | cvbn | mnbv |
Thank you again for your help. Sorry again for my poor first example.
@Mariusz Sorry again but I figured it out!
User | Count |
---|---|
54 | |
23 | |
19 | |
18 | |
17 |
User | Count |
---|---|
91 | |
87 | |
47 | |
30 | |
22 |