Search code examples
sql-serverssasmdx

SSAS Calculated measure to show values only for specific dimension values


I have a calculated Measure in my SSAS cube, which I want to calculate only for a group of dimension members and for rest it should be zero. In The following image I want MTDOccupancy dimension to work only for Account Groups for Rooms, rest related to food should show zero for this field. enter image description here

following is the simple MDX which I am using for MTDOccupancy measure

([MTDQuantity]/[MTDAvailableRooms])*100

Solution

  • You can change the measure to something like the following:

    IIF(
        LEFT([Account Group].[Account Group].currentmember.member_caption,5) = "ROOMS"
      ,([MTDQuantity]/[MTDAvailableRooms])*100
      ,NULL
    )
    

    I have guessed this dimension/hierarchy combination [Account Group].[Account Group]. ... - you will need to change this to reflect the names used in your cube.