Forum Discussion
How to count two columns with names without repeating?
- 6 years ago
Hi,
In the Query Editor, right click on the Operadores column and select Split column. Split by rows there. Create a Calendar Table and build a relationship from the Data column to the Date column of the Calendar Table. Create a slicer from the Date column of the Calendar Table and select any date there. Write this measure
=DISTINCTCOUNT('Table1'[Operadores])
Hope this helps.
If possible, in Query Editor, unpivot Column 2 and Column 3 and then this should be simple. Otherwise, if for some reason that is not possible, you could do this in DAX:
Distinct Count =
VAR __Table =
UNION(
SELECTCOLUMNS('Table',"Operator 1",[OPERATOR 1]),
SELECTCOLUMNS('Table',"Operator 2",[OPERATOR 2])
)
RETURN
COUNTROWS(DISTINCT(__Table))
I can delete columns 2 and 3, So I have the original entry.
- Ashish_Mathur6 years agoSuper User
Hi,
In the Query Editor, right click on the Operadores column and select Split column. Split by rows there. Create a Calendar Table and build a relationship from the Data column to the Date column of the Calendar Table. Create a slicer from the Date column of the Calendar Table and select any date there. Write this measure
=DISTINCTCOUNT('Table1'[Operadores])
Hope this helps.
- Greg_Deckler6 years agoCommunity Champion
Can you post sample data as text so I can test? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
- gabrielrosa6 years agoFrequent Visitor
Ok! Here it is.
DATA MÁQUINA OPERADORES PRODUÇÃO 10/01/2020 1 A,B 1 10/01/2020 2 C 1 10/01/2020 3 D 1 10/01/2020 4 E 1 10/01/2020 5 A 1 10/01/2020 6 B 1 11/01/2020 1 A 1 11/01/2020 2 C,B 1 11/01/2020 3 D 1 11/01/2020 4 E 1 11/01/2020 5 B 1 null null null null - Ashish_Mathur6 years agoSuper User
Hi,
Did you try my solution?