Forum Discussion
measure for classifying sales
Anonymous top man !!!
can I pick your brain cause I want to undestand the logic, not just simply apply it.
the argument
'Seller'[Row ID] <= EARLIER('Seller'[Row ID])
asks the expession to "return" rows with an index earlier than the current index, correct? now "Row ID" is an integer so I can understand the stament. then however, you ask the same for the "reseller" field which is a string in the form of the following argument
Seller[Reseller] = EARLIER(Seller[Reseller]
What does the above achieve? and how can the "EARLIER" statement be relevent to a string column in this case the "reseller"?
Hi Anonymous,
I think i konw your confuse, the EARLIER function will always get the value of the column prior to the current table operation. EARLIER succeeds if there is a row context prior to the beginning of the table scan. Otherwise it returns an error.
It doesn't metter the type of values.
Because the type of value of column Seller[RowID] is numeric, the function EARLIER will return a numeric, so we can use 'Seller'[Row ID] <= EARLIER('Seller'[Row ID]) to compare two numbers. And in the Reseller column, the value's type is text, so the EARILIER will return a text.
Ref: https://msdn.microsoft.com/en-us/query-bi/dax/earlier-function-dax
I don't know if it's clear ;)
Chen
- Anonymous7 years agoNot applicable
Anonymous yes it is a bit comfusing but I think I get the gist of it.
I've tried the solution and it works, many thanks. However, it appears that the problem is not as easy as I though.
when I tried to plot the solution I got the following graph.
I was expecting a smooth increasing trend of the lines, with some downward gaps as some partners "migrated" from small to medium and then to large.
However I got the following instead and I think I understand what the problem is. Not all partners place order EVERY month. thus, if I plot the number of partners sliced by low-mid-high on a monthly level, I get the number of low-mid-high partners that placed orders that month.
However, since these are subscription services, a partner that was "mid" last month and placed 0 orders this month, he remains a mid partner this month. argggghhh
any good ideas?