1

I want to plot revenue for two time periods "Last 30 Days" and "Last 60 Days" on the same diagram. The problem is that for "Last 60 Days" all the data that already is in "Last 30 Days" will not be included.

This is due to my IF clause which looks like this:

IF [Auftragsdatum] >= DATEADD('day', -30, NOW()) AND [Auftragsdatum] <= DATEADD('day', 0, NOW()) THEN 'Last 30 Days'
ELSEIF [Auftragsdatum] >= DATEADD('day', -60, NOW()) AND [Auftragsdatum] <= DATEADD('day', 0, NOW()) THEN 'Last 60 Days' 
END

Does anybody know how to work around this?

ekad
  • 14,436
  • 26
  • 44
  • 46

1 Answers1

0

Create a calculated field called revenue_last_30_days defined as

IF DATEDIFF('day', [Auftragsdatum], TODAY()) <= 30 AND [Auftragsdatum] <= TODAY() THEN [Revenue] END

Create a second calculated field called revenue_last_60_days defined as

IF DATEDIFF('day', [Auftragsdatum], TODAY()) <= 60 AND [Auftragsdatum] <= TODAY() THEN [Revenue] END

Plot both measures as desired, probably using the pseudo fields Measure Names and Measure Values to specify your viz.

If you don't ever have future revenue in your data, you can drop the test checking to be no later than today -- since that will always be true.

Alex Blakemore
  • 11,301
  • 2
  • 26
  • 49