Finding Max Date

Good evening,

I have a dataset that includes a date column. I want to find the maximum date (newest date) so I can filter the dashboard to only show the latest information. My google skills are failing me and I haven’t been able to find how to calculate max date in C#. I’m guessing this is probably something common and very easy to do and I’ll feel silly when I figure it out, but hoping one of you lovely Dundas community members can help me figure it out :slight_smile:

Thank you in advance!

Hi Rachel,

Here is a sample to obtain the most recent date from the records of a data cube and assign it to a filter control

The steps are briefly as the followings:

  1. Create a column in your data cube that always shows the most recent date in your data set, (Detailed steps provided below)

  2. Promote this date with the desired Time dimension (e.g. if you’d like to see only the year, you may promote it with the corresponding Time Dimension),

  3. Use this new column in the Slicer of the Data Analysis panel of your metric set,

  4. Create a New ViewParameter which is bound to your Calendar Range Filter and this Dimension.
    (On a side note, this is possible to bind more than one viewParameter to a single filter control by right clicking on the Filter control -> Connect Filter -> Select Parameters button -> bind to the viewParameters that are required)
    1 2

Now, here is the details for Step #1, on how to create a data cube that has the ‘MostRecentDate’:
3

  1. Add your table to the data cube and uncheck all columns except the Date dimension that you need to see its most recent date.
    4

  2. Use Top/Bottom Transform and return only 1 row of the most recent date, the result would be like this:
    5 6

  3. Create a Calculated Element, that will be used later as the join Key, like below screenshot. It can return anything such as 1.
    7

  4. Add your initial data table once again to your data cube and create a Calculated element as explained above.

  5. Then join the result with this new key.

  6. In the Process result you’ll have the MostRecentDate copied for all rows and also, you have the initial Date column as well.

Now, this would be easy to achieve what you need to do at dashboard level.

2 Likes

Thank you so much! This was very helpful and got me much further along than when I started. I appreciate you taking the time to respond.