Graphing decreasing COUNT as dates approach end date

BlackrazorNZ

New Member
Joined
May 18, 2014
Messages
15
Hi all,

I have a table containing a large number of items which have an expected date of full repayment as a calculated field.

I'm trying to work out a measure for a chart, that shows a value for a COUNT of all the fields between the date itself and the final date.

So if the there are 100 items, first of which is repaid on 1st March 2015, and the last of which is repaid on 1st June 2018, then :
  • The graph would show a count of 100 items at the 1st March 2015 point, and;
  • Would show 1 item on 1st June 2018, and;
  • Would show a decreasing scale between the two as the count between any given date and the last date decreases.

Example of what I want the graph to look like (excuse my amazing MS Paint skills) :

Untitled_zps33ff04eb.png


And here's what the graph looks like with a COUNT function (rather than a rolling decreasing SUM of COUNT which is what I want to try and achieve).

count_zpsf8c980ce.png


Thanks for any help :)
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Btw, this assumes that the date field you put on your chart comes from the Calendar table as well.

I think is your only problem. Your chart is trying to use dates from your data/fact table, which is not what you meant. Use fields from your calendar table (Date Range in your case).
 
Upvote 0
You are using ExpQtr and ExpYear from your combined-data-file table. You need to use dates out of your Date/Calendar table (called "Date Range" in your model), or things will not work.

This will be a common theme. All DAX methods that do time intelligence (DATESINPERIOD, DATESYTD, SAMEPERIODLASTYEAR, etc) will work against your calendar table. Get used to it :)

While I am thinking about it though -- your calendar table has dates WAAAAY off into the future, will WILL have negative performance implications. You might want to trim that.
 
Upvote 0
OK cool, working much better now, really appreciate your help :)

Last question : How do I hide the spike at the end that appears to be deriving its data set from blank cells?

I can do it with a slicer to cut out blanks, but that looks a bit ugly.

decline_zps3db43da3.png
 
Upvote 0
So, you have a relationship between ExpPayment and your Date Range table... but there is a value in ExpPayment that isn't in your Date Range table... blank. So, that is causing some weirdness.

I generally try to start from pretty "base" measures:

So, I would have something like
TotalExpectedPayments := COUNT('Combined-Data-File'[ExpectedRepayment])
Then, when I ran into the problem you are seeing, I would make it a bit more complicated, but ALL measures that used [TotalExpectedPayments] would gain the benefit of changing in this 1 place.

It would become:
=CALCULATE(COUNT('Combined-Data-File'[ExpectedRepayment]), FILTER('Date Range', 'Date Range'[Day] <> BLANK()))

Which would filter out those rows...
 
Upvote 0
Awesome, starting to make some headway now, you've been a heap of help.

I've now imported a much bigger data set, about 100,000 lines. The calculated residual works as a value for summing the total $ outstanding, and I can break it down by branch as expected. But when I try to add a slicer to the graph version using the measure you've helped me with, for some reason it only shows 1 branch in the data set?

As per :

Resid1_zpsa143e87b.jpg


vs (note the last slicer)

Resid2_zps459910c2.jpg
 
Upvote 0

Forum statistics

Threads
1,223,996
Messages
6,175,864
Members
452,678
Latest member
will_simmo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top