Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone,
I'm wondering if there is a way to group by unique values in one column and still conduct analysis on the other columns. Looking at the sample data below, I am trying to group by case, and create a new column that will be either "yes" or "null" with the condition that a drug either appears twice for a case OR has a numerical value (i.e., not QTOF under the screen column).
In this example, case A would be null for all drugs, case B would be yes for all drugs, case C yes only for advil, and case D yes for all. (see below)
Is there a way I can do this? Thanks in advance!
Solved! Go to Solution.
Hi @Anonymous
You can add a column with below DAX. Modify table name per your need. Power BI does not support merging cells like in Excel, so it will show a "yes" or "null" value on every row.
Column =
VAR _condition1 = IF(CALCULATE(COUNT('Table (2)'[Case]),ALLEXCEPT('Table (2)','Table (2)'[Case],'Table (2)'[Drug])) > 1, 1, 0)
VAR _condition2 = IF(IFERROR(VALUE(RIGHT('Table (2)'[Screen],1)),-1) = -1, 0, 1)
RETURN
IF(_condition1=1 || _condition2=1, "yes", "null")
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @Anonymous
You can add a column with below DAX. Modify table name per your need. Power BI does not support merging cells like in Excel, so it will show a "yes" or "null" value on every row.
Column =
VAR _condition1 = IF(CALCULATE(COUNT('Table (2)'[Case]),ALLEXCEPT('Table (2)','Table (2)'[Case],'Table (2)'[Drug])) > 1, 1, 0)
VAR _condition2 = IF(IFERROR(VALUE(RIGHT('Table (2)'[Screen],1)),-1) = -1, 0, 1)
RETURN
IF(_condition1=1 || _condition2=1, "yes", "null")
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hello,
I am trying this out now and it is telling me "Too many arguments were passed to the COUNT function. The maximum argument count for the function is 1."
Hi @Anonymous
Did you miss the right parenthesis next to Case column?
IF(CALCULATE(COUNT('Table (2)'[Case]),ALLEXCEPT('Table (2)','Table (2)'[Case],'Table (2)'[Drug])) > 1, 1, 0)
Best Regards,
Community Support Team _ Jing
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 56 | |
| 45 | |
| 35 | |
| 34 | |
| 21 |
| User | Count |
|---|---|
| 143 | |
| 122 | |
| 100 | |
| 80 | |
| 57 |