Forum Discussion
New Computed Column
- Anonymous7 years ago
Anonymous - You could do the following steps:
1. Order by Customer.
2. Add an index column starting from 0, and another starting from 1.
3. Merge the table with itself, joining the one index column to the other. This way, you can retrieve the previous customer.
4. Add a Custom Column that returns 0 if the current and previous customers are the same, otherwise 1.
Using an Excel formula (if the source is a spreadsheet) is easier:
1. Order by Customer.
2. Add a new column, with the following formula (Assumes that CustomerID is in Column A):
=IF(A2=A1,0,1)
Hope this helps,
Nathan
Anonymous -
You could use DISTINCTCOUNT function in a Measure to get the distinct count. That way, you would always get the correct count, regardless of the filter context. If you have a one in some rows and not others, the "1" row may be filtered out in some situations, producing a wrong result.
Distinct Customers = DISTINCTCOUNT('Sales'[CustID])Hope this helps,
Nathan
- Anonymous7 years agoNot applicable
Hey Anonymous Thanks, I'm using PowerQuery through the excel and not through the desktop app.
i'm aware about the wrong result the may be, but im still need it on this way. Thanks!
- Anonymous7 years agoNot applicable
Anonymous - You could do the following steps:
1. Order by Customer.
2. Add an index column starting from 0, and another starting from 1.
3. Merge the table with itself, joining the one index column to the other. This way, you can retrieve the previous customer.
4. Add a Custom Column that returns 0 if the current and previous customers are the same, otherwise 1.
Using an Excel formula (if the source is a spreadsheet) is easier:
1. Order by Customer.
2. Add a new column, with the following formula (Assumes that CustomerID is in Column A):
=IF(A2=A1,0,1)
Hope this helps,
Nathan
- Anonymous7 years agoNot applicable
Thanks Anonymous ,
I think it will help and i'm almost there.
At step 2 (i'm using PowerQuery) - you meant a column with ascending series (starting from 0) or all the column be with "0"?EDIT:
Got you about the index coulmn, but which coulmn I need retrive after I merged?

Thanks!