Forum Discussion

angelocecinati's avatar
angelocecinati
Frequent Visitor
8 years ago
Solved

Cumulative Total over a measure

Hello everyone!

 

I have to create a cumulative value (MG%Cumulative) according to a rank measure (Rank).
I had some trouble using the standard calculate-filter solution cause the filter function requires a column from the underlying table, while I have to filter according to a measure.

 

ItemRevenueRankMg%Mg%Cumulative
101100.000140%40%
10380.000230%70%
10250.000320%90%
10510.000410%100%

 

NOTE: The pbix is created with a direct query on a SSAS Tabular cube and I've no acces to the underlying tables.

Thus I should resolve the issue just using measures.
Thanks in advance,
Angelo

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi angelocecinati,

     

    Can you share more detailed contents about your situation?
    I'm not so sure how MG measure calculated, it will be help if you share measure formula and expected result.

     

    Regards,

    Xiaoxin Sheng

     

    • angelocecinati's avatar
      angelocecinati
      Frequent Visitor

      Hi Anonymous,

       

      Sure! The MG measure is not so important. We can simplify further the example in this way:

       

      ItemRevenueRankRevenue Cumulate
      101100.0001 100.000   
      10380.0002 180.000   
      10250.0003 230.000   
      10510.0004 240.000   

       

      I want to compute the Revenue Cumulate according to the Rank measure.

      The Revenue is a measure coming directly from the cube. And I've not visibility about its computation.

      The Rank is a measure computed as follow:

      Rank = if (HASONEVALUE

                                (ItemsTable[Items])

                                ,RANKX(ALL(ItemsTable[Items])

                                              ,[Revenue],,,Dense)

                       ,BLANK()

                       )

      The Revenue Cumulate has to show the highest revenue in the first row, the sum of the first and the second highest in the second row and so on.

       

      I hope to be clear,

      Thanks a lot,

       

      Angelo

      • Zubair_Muhammad's avatar
        Zubair_Muhammad
        Icon for Community Champion rankCommunity Champion

        angelocecinati

         

        Try this MEASURE in ITEMSTABLE

         

        Revenue Cumulative =
        VAR CurrentRow = [Rank]
        RETURN
            SUMX (
                FILTER ( ALLSELECTED ( ItemsTable[Item] ), [Rank] <= CurrentRow ),
                [Revenue]
            )