Forum Discussion
Partner Count
Hi mwegener
the above calculation is not working and giving error.
I want calculation on sales of Customercode from customer table
If customer has done sales in current year and not in last year are new customers and check sales of customer has done sales in last year and not in current year are lost customers
Tables are Sales table(Net value),Customer table(customer code), Calender Table (year)
Hi Anonymous ,
maybe you can share a screenshot of the model view so I can see the tables, columns and relationships.
- Anonymous2 years agoNot applicable
- mwegener2 years agoMost Valuable Professional
Hi Anonymous ,
I would perform the customer count on the sales table.
The code should then look something like this.
The calendar table must be marked as a date table for the time logic.
new Customers = VAR _customersPreviouseYear = CALCULATE(DISTINCTCOUNT(Sales[CUSTOMERCODE]), PARALLELPERIOD('Master_Calendar'[Date],-1,YEAR)) VAR _customersBothPeriods = CALCULATE(DISTINCTCOUNT(Sales[CUSTOMERCODE]), UNION(PARALLELPERIOD('Master_Calendar'[Date],-1,YEAR),PARALLELPERIOD('Master_Calendar'[Date],0,YEAR))) RETURN _customersBothPeriods - _customersPreviouseYearlost Customers = VAR _customersThisYear = CALCULATE(DISTINCTCOUNT(Sales[CUSTOMERCODE]), PARALLELPERIOD('Master_Calendar'[Date],0,YEAR)) VAR _customersBothPeriods = CALCULATE(DISTINCTCOUNT(Sales[CUSTOMERCODE]), UNION(PARALLELPERIOD('Master_Calendar'[Date],-1,YEAR),PARALLELPERIOD('Master_Calendar'[Date],0,YEAR))) RETURN _customersBothPeriods - _customersThisYear- Anonymous2 years agoNot applicable
Hi mwegener ,
Thanks for the response, but issue not yet resolvedAs per the above measure im getting the below error when i'm adding data to matrix visual with year and values