14,449,862 members
Rate this:
See more:
I have been facing some problem to calculate profit in matrix mlm plan.

I this plan each Node can have 3 nodes

For level 1 Total Node count 3 , parent node will be get benefit of 90 Rs. Means 3 × 30@=90
Level 2 - node count 27 benefit will be
27× 10= 270

Level 3 node count 81 , benefit 81× 5=405

.........and so on ...

What I have tried:

I have tried to calculate profit at time of user registration form sql server stored procedure.
Posted
Updated 10-Feb-20 9:31am
Richard MacCutchan 10-Feb-20 3:36am

Please edit your question and show the failing code, and explain exactly where the problem occurs.
Dave Kreskowiak 10-Feb-20 15:31pm

You do know that MLMs are a scam, right?

Rate this:

## Solution 1

to me on the basis of what you stated I would utilize a loop and scalar function

I wouldset each level as an increment in a loop. For each increment send to the function, the level and the values associated with that level.

The scalar function would carry all logic for the levels.

Based on the above I am only giving you what is off the top of my head as I feel your question lacks some further detail to answer the question more specifically.

while loop tsql
WHILE (Transact-SQL) - SQL Server | Microsoft Docs[^]

create function tsql

[^]