Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hey guys,
I need your help with a couple of calculated column or measures.
Below my sample data:
Source Key Validation
a 3 Needs Checking
a 1 Needs Checking
a 1 Needs Checking
a 1 Needs Checking
a 1 Needs Checking
b 2 Good
b 2 Good
b 2 Good
What I need is for the "Validation" column to tell me if the source values contain more than 1 "Key" for each "Source". In the above sample, Source "b" is fine because it only has the Key "2", while Source "a" is not ok because it contains Key "1" four times and also Key "3".
Secondly, I also need to know if the same Key value is present in more than one Source. Below, another sample. In the sample, Key "3" is present in Source "a" and "C", which isn't ok.
Source Key Validation Validation2
a 3 Needs Checking Needs Checking
a 1 Needs Checking Needs Checking
a 1 Needs Checking Needs Checking
a 1 Needs Checking Needs Checking
a 1 Needs Checking Needs Checking
b 2 Good Good
b 2 Good Good
b 2 Good Good
c 3 Good Needs Checking
For the first one:
Validation Column =
IF(
COUNTROWS(
SUMMARIZE(
FILTER('Table',[Source] = EARLIER([Source]),
[Key]
)
) > 1,
"Needs Checking",
"Good"
)
For the second:
Validation Column 2 =
IF(
COUNTROWS(
SUMMARIZE(
FILTER('Table',[Key] = EARLIER([Key]),
[Source]
)
) > 1,
"Needs Checking",
"Good"
)
Thank you Greg, your solutions work.
For future people who need this, there is a ")" missing after each EARLIER([Key]),
| User | Count |
|---|---|
| 54 | |
| 37 | |
| 26 | |
| 16 | |
| 16 |
| User | Count |
|---|---|
| 69 | |
| 57 | |
| 38 | |
| 21 | |
| 21 |