US and Worldwide: +1 (866) 660-7555
Results 1 to 5 of 5

Thread: Axis function replacement

  1. #1

    Default Axis function replacement

    Hi all,

    I need to migrate a cube made in Analysis services which has two measures that uses the Axis function:

    Code:
    IIF(    (StrToMember("[" + strtoset("Axis(1)").item(0).item(0).dimension.name + "].CurrentMember").Parent,[Measures].[sales]) = 0,
        null,
        [Measures].[sales] / (StrToMember("[" + strtoset("Axis(1)").item(0).item(0).dimension.name + "].CurrentMember").Parent, [Measures].[sales])
    )
    and:
    Code:
    [Measures].[units]/(ancestor(
                        strtoset("Axis(0)").item(0).item(0).dimension.currentmember,
                        strtoset("Axis(0)").item(0).item(0).dimension.Levels(0)
                        ),
                    [Measures].[units])
    I've seen that julian suggests to use named sets but I don't understand how to implement them.

    Any help would be apreciated, thanks!

  2. #2

    Default


  3. #3
    Join Date
    Jan 2013
    Posts
    472

    Default

    Unfortunately Mondrian doesn't have the Axis() function.

    In the two example it looks like the calculation is using the value of the first attribute in the tuple on rows. Can you describe the use case a bit? There may be alternative ways to approach the problem.

    BTW, named sets really just give you a way of defining upfront a set that can be used elsewhere. They can be defined in either in the cube or the WITH block of your MDX.

  4. #4

    Default

    The idea of the members is to calculate the percentage of total amongst the first dimension of the view, independently of which dimension had you chosen.

    For example, if I have this view:
    Dim1.Level1 Dim1.Level2 Dim1.Level3 Dim2.Level1 Dim2.Level2 Sales Calc Member
    Total Channels Country 26.873.934 100,00%
    Total Channels Country Region 1 10.979.493 100,00%
    Total Channels Country Region 2 15.894.441 100,00%
    Total Channels Total Food Country 26.873.934 100,00%
    Total Channels Total Food Country Region 1 10.979.493 100,00%
    Total Channels Total Food Country Region 2 15.894.441 100,00%
    Total Channels Total Food Direct Country 4.357.820 16,22%
    Total Channels Total Food Direct Country Region 1 1.691.058 15,40%
    Total Channels Total Food Direct Country Region 2 2.666.763 16,78%
    Total Channels Total Food Indirect Country 22.516.114 83,78%
    Total Channels Total Food Indirect Country Region 1 9.288.436 84,60%
    Total Channels Total Food Indirect Country Region 2 13.227.678 83,22%

    Then if I exchange dimensions, I stil want the calc member to show the right values:

    Dim2.Level1 Dim2.Level2 Dim1.Level1 Dim1.Level2 Dim1.Level3 Sales Calc Member
    Country Total Channels 26.873.934 100,00%
    Country Total Channels Total Food 26.873.934 100,00%
    Country Total Channels Total Food Direct 4.357.820 100,00%
    Country Total Channels Total Food Indirect 22.516.114 100,00%
    Country Region 1 Total Channels 10.979.493 40,86%
    Country Region 1 Total Channels Total Food 10.979.493 40,86%
    Country Region 1 Total Channels Total Food Direct 1.691.058 38,81%
    Country Region 1 Total Channels Total Food Indirect 9.288.436 41,25%
    Country Region 2 Total Channels 15.894.441 59,14%
    Country Region 2 Total Channels Total Food 15.894.441 59,14%
    Country Region 2 Total Channels Total Food Direct 2.666.763 61,19%
    Country Region 2 Total Channels Total Food Indirect 13.227.678 58,75%
    Last edited by bmasciarelli; 06-04-2014 at 03:29 PM. Reason: Error

  5. #5
    Join Date
    Jan 2013
    Posts
    472

    Default

    Someone else might be able to come up with a clever trick, but the best I can offer is to use a set dimension specific members.

    Won't help you now, but you also may want to vote for MONDRIAN-487, which is the case to implement Axis().

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •