Forum Discussion
jaimemagana
6 years agoNew Member
DAX table - CRM
Hi there, I´m pretty new to Power Bi, so bare with me for minute. I wnat to analyze my client portfolio and detect sales opportinuties. For that I need to undestand my customer behaviour. I want...
amitchandak
6 years agoSuper User
jaimemagana , try like
TableCRM =
summarize(carsales,
Calendar[year],
Clients[clientid],
"Cars Bought", calculate(count(carsales[saleID]), userelationship(calendar[date], carsales[date])),
"Repairs", calculate(count(repairs[repairID]), userelationship(calendar[date], repairs[date]))
)
jaimemagana
6 years agoNew Member
First, and foremost, thanks your replying.
Almost, but not quite. But you've given me the righ track to seek. With your code the Year colum does not work. Also, I have to set the main table to summarize to Clients, by Client ID. Then I am able to calculate the measures "Repairs" and "Cars Bought"
TableCRM =
summarize(
Clients,Clients[idClient],
"Cars Bought", calculate(count('Sales'[Saleid]), userelationship(Calendar[Date], 'sales'[Date])),
"Repairs", calculate(count(Repairs[idRepair]), userelationship(Calendar[Date], Repairs[Date]))
)
Remmember that Sales, Clients and Repairs are separate Tables. Since I did not post the relationships and tables of the model befre, I´ll do it now.
So, the code from above is actually:
TableCRM =
summarize(
Clients,Clients[GCLI-idclie],
"Cars Bought", calculate(count('Sales'[BASTIDOR]), userelationship(Calendar[Date], 'Sales'[MATRICULA_1])),
"Repairs", calculate(count(Repairs[TOCA-numors]), userelationship(Calendar[Date], Repairs[TOCA-feccie]))
)
What I am missing is the Year field (Año) in the Calendar table.
Does this help?