Forum Discussion
Countif combination in Power BI
- 6 years ago
Hi Anonymous
I would like to add a column, which in Excel would look like: countif($A$2:$A2,$A2). This will count the number of unique customer_id's from 1 to x.
Kindly let me know if you'd like to get the below results: If not please kindly disclose the expected results.
Measure = DISTINCTCOUNT('Table'[Customer_ID])I would also like to add a column that count both the customer_id and the computername, in Excel this would be countifs(customer_id:customer_id,computername:computername).
Not quite understand this requirement, please kindly elaborate and disclose the expected results.
Hi Anonymous
I think DISTINCTCOUNT might be what you are after.
This would not be used in a calculated column as it would just evaluate to 1 within each row context. However, as a measure, it will calculate the number of unique values within whatever filter context you throw at it.
For example, for the number of unique customer IDs you would write a measure as follows:
NoOfCustID =
DISTINCTCOUNT( [Customer_ID (text)] )
Hope this is what you're after.
Pete