Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

Find hiearchy name at runtime for decision making based on drilldown.

$
0
0

Hello,

I want to implement a calculation such that if the user selects one of the two hierarchies in Date Dimension, then different calculation should happen.

Background, I have two hierarchies in Date Dimension.

 Hierarchy1 >> Date> Month > Year

 Hierarchy2 >> Date > Business week

I want to implement a funtionality to show Profit&Loss based on selection.

Hierarchy 1 selection scenarios

  • If Hierarchy1 is selected by user, and the selection is at date level, then it would compare P&L for previous date and current date
  • If Hierarchy1 is selected amd selection level is at month level, then it would compare P&L with previous month v.s current selected month.
  • If Hierarchy1 is selected and selection level is at year level, then it would compare previous Pyear P&L v.s current year P&L

Hierarchy 2 selection scenario

  •    If hierarchy-2 is selected then i would like to show previous week P&L v/s Current week P&L.

Here is what i am trying to achieve using this formula, however, it seems that[DimDate].HIERARCHY.NAME = "Hierarchy2" clause is wrong. If it was single hierarchy, it would work flawlessly.

if(
[DimDate].HIERARCHY.NAME = "Hierarchy2"
,
([Measures].[Profit And Loss Amt In USD],[DimDate].[DimDatePerWeek].prevmember)
,
([Measures].[Profit And Loss Amt In USD],[DimDate].[DimDate].prevmember)
)


Viewing all articles
Browse latest Browse all 14337

Trending Articles