Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
avantime
Creator II
Creator II

Load clients with no turnover

Hi all,

Right now I am loading clients with turnovers from a qvd file like:

Load

[Client ID],

[Invoice date],

[Invoice number],

Turnover,

Year([Inovice date]) as Year,

Month([Invoice date]) as Month

From (qvd);


This works ok, but I would also like to see the clients that have no turnover.

For this I figured that I should concatenate the invoices database with the clients database, but I have not succeeded in having a good result. The rest of the clients should show up with 0 as turnover for each month in which they had no turnover.

Any ideas?

Thanks a ton!

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Sum(Amount) + If(Len(Trim(Max({1} TOTAL <Year> Year))) > 0, Avg({1} TOTAL 0.0000000001))

View solution in original post

26 Replies
swuehl
MVP
MVP

Not exactely sure what you want to achieve.

You can create a matrix of all customers, years and months by JOIN'ing all year month combinations (which you can load from your QVD or generate e.g. with a master calendar) to the complete list of customers loaded from your customer table:

TMP:

LOAD DISTINCT Year, Month

RESIDENT YourFactTable;

JOIN

LOAD ClientID

FROM Customer.qvd (qvd)

STORE TMP INTO YearMonthClient.qvd (qvd);

DROP TABLE TMP;

Now you can concatenate or join this table to your fact table to have a fact table with all combinations of Year, Month and Customer (if this is what you were asking for):

CONCATENATE (YourFactTable)

LOAD ClientID, Year, Month

FROM YearMonthClient.qvd (qvd);

avantime
Creator II
Creator II
Author

Hi Stefan,

InvoicesDatabase.qvd contains only clients that purchased something at least one time during said period.

Now if I want to check which clients have a lower than X total revenue during said period, I will only see clients with a total revenue lower than X but not clients that did not purchase anything at all.

In my mind the solution is to cross check the clients in InvoicesDatabase.qvd with the complete clients database.

For example I have the following database of invoices for a defined period:

ClientIDRevenue
A100
E24
F23
I22
K32

But I have clients A,B,C,D,E,F,G,H,I,J,K,L

So the table should look like:

ClientIDRevenue
A100
B0
C0
D0
E24
F23
G0
H0
I22
J0
K32
L0

Hope you got it

Thanks!

swuehl
MVP
MVP

I think that's basically what my last post should return, when using an expression like

=Sum(Revenue)

and dimensions like ClientID, Year and Month.

In your specific example with only client and Revenue, you also use something like

LOAD

     ClientID, Revenue

FROM YourFactTable.qvd (qvd);

CONCATENATE

LOAD ClientID, 0 as Revenue

FROM YourClientTable.qvd (qvd)

WHERE NOT EXISTS(ClientID);

avantime
Creator II
Creator II
Author

I`ll try it tomorrow, let you know how it goes. Thank you!

avantime
Creator II
Creator II
Author

I tried your solution Stefan, it works OK until I select a date, then clients with 0 turnover dissapear.

If no date is selected, then I can see clients with 0 turnover.

On any given date I select, I want to see a list complete with clients with turnover and clients with no turnover.

Right now I realize that maybe concatenation is not the way to go, given the fact that if I load the db with clients turnover in 2016 and concatenate it with the clients db it will add only clients with no turnover in 2016, not clients that had no turnover on a specific day, for example.

Maybe a formula?

avantime
Creator II
Creator II
Author

Back to my problem.. It remains unresolved. Any fresh ideas?

timsaddler
Creator III
Creator III

You need to force a nominal zero 0.00001 for each timeframe (presume month?) to trigger the field in the report maybe

avantime
Creator II
Creator II
Author

Hi, thanks for the answer!

Can you please direct me on how I can do that? Thank you!

sunny_talwar

How about this:

=Sum(Revenue) + Avg({1<ClientID = P(ClientID)>} 0)