Forum Discussion

Kalisto87's avatar
Kalisto87
Frequent Visitor
8 years ago
Solved

Creating cumulative measure based on dynamic ranking / Dynamic running total/pareto diagram-measure

Hi,

 

I have a very interesting problem I believe:

 

I need help with creating dynamic totals/pareto diagram on suppliers based on sales, and categorize the supplier in categories based on their acculmulated sales. I.e a A supplier is one of the supplier in the interval of 0-80% accumulated sales (ABC-analysis). 

 

My data is a large table with all the spend of a company. This means multiple rows per supplier containing all single purhaces from all suppliers, including what year the purchase was made. 

 

 

I have done quite som googling and know about the solution calculate(sum(sales),allselect(date,date<=max date))). However this does not work on my table as I want the ranking/cumulative sales/category/ to change in the report with.

 

This was the result when using the above formula, but the result does not care about what year is selected. (The peak is just a double entry error in the data set)

 

 

 

Now, the main issue as I understand it: 

 

I have made a dynamic ranking measure with the formula Ranking1 = RANKX(ALLSELECTED('Sales'[SupplierID]);CALCULATE(SUM('Sales'[Sales]))), and it works great. I also have dynamic sum measures, and percentage of total spend per supplier, all dynamic with year selected.

 

The problem is when I try to accumulate the percentages to create a pareto diagram as I did above (I followed this receipe to create the "static" pareto https://powerbi.tips/2016/10/pareto-charting/). Is is not possible to create a cumulated measure based on a ranking measure as I understand.  This is what I want to work: 

 

**bleep**. total = CALCULATE(SUM('Sales[Sales]);FILTER(ALLSELECTED('Sales');[Ranking1] <= MAX([Ranking1]))). However this gives the error on the max function, because it cannot calculate max on the measure.

 

This is the dynamic results I have so far, but I have no way of cumulating the percetages og categorixing suppliers based on them..

 

Any help would be greatly appreciated!

 

 

19 Replies

  • Hi,

     

    As  in understand, you'd like to create a column where you want to accumulate the percentages in the prosentbridag column.  Am i correct?  Please share the link from where i can download your file.

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi Kalisto87,

     

    The Ranking 1 is a measure, which means it's dynamical. I think some functions, such as summarizeaddcolumn, could help in this scenario that another measure bases on a dynamical measure. But we can't do more without data. Please share a dummy sample .pbix file.

     

    Best Regards!

    Dale

      • Kalisto87's avatar
        Kalisto87
        Frequent Visitor

        Hi Vvelarde

         

        A quick update:

         

        I was able to get the measure to work, and it works great! Thanks.  However, I am not able to make a table counting distinct number of suppliers of each category of accumulated spend (so called ABC-analysis)

         

        Please see the picture below to see the updated results. As marked in the red circle, the table does not understand that I want to see distinct number of suppliers in each category. Any ideas of how to remedy this problem?

         

        The formula for the categorization is 

        Supplier Category = IF([Accumulated spend per supplier]/[Total spend]<=0,8;"A - 80% of spend";IF([Accumulated spend per supplier]/[Total spend]<=0,95;"B - 80-95% of spend";"C - 95-100% of spend"))

         

         

        As you can see the formula works great when I list all suppliers in the table to the left, but not in the table to the right. I have also uploaded the updated .pbix model here: https://www.dropbox.com/s/gviw1r3gmdm3ssx/Dummy1.pbix?dl=0

         

         

        Any help is greatly appreciated!

         

        /André

  • Kalisto87's avatar
    Kalisto87
    Frequent Visitor

    I discovered that it is not possible to remove any of the suppliers in the report level filter, any ideas to why? The screenshot explains the error.

     

    It is possible to selct only one supplier in the report level filter, but if I deselect one supplier the pareto formula crashes. Unfortunately the formula is too advanced for me to pinpoint where the error lies, and the Power BI error message does not help much..

     

    • bryanz's avatar
      bryanz
      Regular Visitor

      Were you ever able to figure out the issue with multiple values provided but a single value expected? I am running into a similar issue where if the field I'm aggregating (customer name in may case, instead of supplier name) is filtered, the error is shown. It seems like it has to be all items in the table. Even creating just a portion of the formula in the dummy pbix file results in the error.