Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX 2012 R3 - Modifying cube query

(0) ShareShare
ReportReport
Posted on by 244

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

  • Durai Murugan Raman Profile Picture
    244 on at
    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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans