MDX Builder Expression


  • Hi, I am new to SQL builder and I am trying to find a way to add a column (probably as a calculated field) using MDX Expression. I have two different dates and I need to calculate the age. It's probably something very simple...
    Friday, February 28, 2014 8:06 PM


  • Hi zdenkamasar,

    If I understand correctly, you are using Microsoft SQL Server Analysis Services as data source, and you want to add a calculated field to calculate difference between two date fields. In Reporting Services, we always use VB expression to add a calculated field regardless the data source type. So in your scenario, we can use the expression below to calculate the difference year between the two date fields (StartDate and EndDate) as a new field in the current dataset:

    If we want to return other interval between the two fields, we can refer to the following values:

    • yyyy - Year
    • q - Quarter
    • m - Month
    • d - Day
    • ww - Week of year
    • h - Hour
    • n - Minute
    • s - Second

    If there are any misunderstanding, please elaborate the issue for further investigation.

    Katherine Xiong

    Katherine Xiong
    TechNet Community Support

    Wednesday, March 05, 2014 9:21 AM