dbTalk Databases Forums  

Should I use Max() or a Order() function

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Should I use Max() or a Order() function in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SAM
 
Posts: n/a

Default Should I use Max() or a Order() function - 09-08-2006 , 04:22 PM






I created this calculated member that works good:

IIf(IsEmpty([Measures].[Amount Due]), 0,
datediff("d", [Measures].[Invoice Date], [Measures].[Current Date]))

It gives me the number of days past since the invoice created.

I will provide an example of what I am getting now:

Account Name Invoice Amount Due Days Past Invoice Date

Rental Company $475.00 69 7/1/2006

You will have to drill down to the invoice level:
- 7341 $0 0
2/28/2006
- 8343 $188.00 169
4/1/2006
- 9408 $198.00 99
6/1/2006
- 10196 $89.00 69
7/1/2006

I want the maximum days past to be displayed at the Account Name level
without having to drill down. At the Account Name level it gives the most
recent date and I want it to show the max days past, i.e. 169.

Anyone have any ideas on how to do this? I thought using Max() would work
but it is not changing from account name to the invoice level. Order by date
at the Account Name level, I don't think is the right function to use.

Reply With Quote
  #2  
Old   
SAM
 
Posts: n/a

Default RE: Should I use Max() or a Order() function - 09-08-2006 , 04:33 PM






I am thinking that I can use topcount() but not sure how to incorporate the
syntax in what I have working already.

"SAM" wrote:

Quote:
I created this calculated member that works good:

IIf(IsEmpty([Measures].[Amount Due]), 0,
datediff("d", [Measures].[Invoice Date], [Measures].[Current Date]))

It gives me the number of days past since the invoice created.

I will provide an example of what I am getting now:

Account Name Invoice Amount Due Days Past Invoice Date

Rental Company $475.00 69 7/1/2006

You will have to drill down to the invoice level:
- 7341 $0 0
2/28/2006
- 8343 $188.00 169
4/1/2006
- 9408 $198.00 99
6/1/2006
- 10196 $89.00 69
7/1/2006

I want the maximum days past to be displayed at the Account Name level
without having to drill down. At the Account Name level it gives the most
recent date and I want it to show the max days past, i.e. 169.

Anyone have any ideas on how to do this? I thought using Max() would work
but it is not changing from account name to the invoice level. Order by date
at the Account Name level, I don't think is the right function to use.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.