Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

AX 2012 R3 - Modifying cube query

(0) ShareShare
ReportReport
Posted on by 240

Hi

I am new to cubes. I am using AX 2012 R3 with CU 13. I tried to modify the MDX query used by the report SalesPerformanceByProducts. I am using the Retail Cube to create a new SSRS report and below is the modified query based on client requirement to include category name to the rows. But I am getting error

WITH

//MEMBER ColumnName as "Amount"

//MEMBER RowCount as 100

//MEMBER Company as "ceu"

//MEMBER standalone as "False"

//MEMBER FromDate as "1/1/1900"

//MEMBER ToDate as "1/1/2154"

//Member ItemGroup as "Lighting Business Unit Sales Hierarchy"

SET [OrderedBy]

AS

(

Case WHEN @ColumnName = "Amount" THEN

TOPCOUNT(ORDER(

NonEmpty([Released products].[Product number].[Product number],

{[Measures].[Customer invoice line amount - accounting currency]}),

[Measures].[Customer invoice line amount - accounting currency], DESC),@RowCount)

WHEN @ColumnName = "Quantity" THEN

TOPCOUNT(ORDER(

NonEmpty([Released products].[Product number].[Product number],

{[Measures].[Customer invoice quantity - sales unit]}),

[Measures].[Customer invoice quantity - sales unit], DESC),@RowCount)

WHEN @ColumnName = "Profit" THEN

TOPCOUNT(ORDER(

NonEmpty([Released products].[Product number].[Product number],

{[Measures].[Gross profit margin]}),

[Measures].[Gross profit margin], DESC),@RowCount)

END

)

SELECT {[Measures].[Customer invoice line amount - accounting currency],

[Measures].[Customer invoice quantity - sales unit],

[Measures].[Gross profit margin],

[Measures].[Gross profit margin percentage]} ON COLUMNS ,

{ [OrderedBy] *

[Released products].[Product name - Released products].[Product name].members

,[Released products].[Item group name - Released products].[Item group name].members

}

on Rows from [Retail cube]

where (

strtomember('[Company].[Company].&[' + @Company + ']'),

IIF(@standAlone = "True", [Retail category].[Parent category].[All],

strtomember(@ItemGroup)

)

,

{STRTOMEMBER("[Date].[Date].[Date].&[" + format(CDate(@FromDate),

"yyyy-MM-dd") + "T00:00:00]"): STRTOMEMBER("[Date].[Date].[Date].&

[" + format(CDate(@ToDate), "yyyy-MM-dd") + "T00:00:00]")})

 

 

Please guide me solve this error.

 

Regards,

Durai Murugan R

*This post is locked for comments

  • RE: AX 2012 R3 - Modifying cube query

    AXError.jpg

    Attached is the error.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans