MDX conversion

K P 61 Reputation points
2022-05-11T14:13:42.073+00:00

I have a sql query which i want to convert into MDX for ssas (not too strong in MDX). below is the query.

select appmn (varchar), programid (int), period (datetime), sum(amt) from tableA
group by appmn, programid, period

in cube appmn, programid and period are in separate dimension. I want to add this functionality in calculated members in cube as well.

Thank you,
Kash

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,244 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. ZoeHui-MSFT 32,736 Reputation points
    2022-05-12T01:52:58.257+00:00

    Hi @K P ,

    Thanks for posting here. In SSAS multidimensional mode, you did not have to create a calculated member in cube. We just need to define relationships between Dimensions and Measure Groups, then we just need to drag the dimension attributes and measure, the results will show as your SQL query does.

    Regarding how to define relationships between Dimensions and Measure Groups, please refer to below official document:

    lesson-5-defining-relationships-between-dimensions-and-measure-groups

    Regards,

    Zoe


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. K P 61 Reputation points
    2022-05-12T13:10:02.62+00:00

    @ZoeHui-MSFT
    The sum of amt is 1st by Program ID, AppMN and then Period but until period gets into view, the sum is not working properly that's why i am trying to bind. The total of AMT supposed to be 100, but if period is not there then it shows more then 100 ! In below table, i m just showing January but if there is Feb and so on then sum goes higher then 100 without date. I want to show with or without date 100 !
    201507-forcube.jpg

    0 comments No comments

  3. Olaf Helper 40,741 Reputation points
    2022-05-13T06:34:20.953+00:00

    I have a sql query which i want to convert into MDX

    There is no straight ahead way to "convert" SQL to MDX.
    You have to write the MDX on your own. Without knowing the cube design we can only give some hints.

    sum(amt) from tableA

    A aggregation like SUM in SQL is a measure in a cube, you get it automatically in MDX by cube desighn; which we don't know.

    0 comments No comments