Forum Discussion

andreazambon's avatar
andreazambon
Icon for Helper V rankHelper V
2 years ago

Measure build with filter() funztion in a Graph

Hi there, 

 

I setted a measure to give me the 1st, 2nd and 3rd ranked production line order by %scrap value. Here's an example

 

 

%Scrap_1st_CDL = filter(ALL(SAPWorkCenter[CDL]), [Rank_CDL_by_ScrapValuekg]=1)

 

 

My goal is to put in 3 different graphs the first, second and third line ranked in the same way, showing the %scrap value month by month. 

The problem is to show the graph for the 2nd and 3rd line. 

So ,I've built these measures and I wanted to put them in the Legend of my graph, but PBI allows me to put them only in the tooltips. 

 

Any suggestion to help me?

Thanks.

2 Replies

  • andreazambon , Please use New Index function for that, Assume %scrap is a measure

     

    top 1= calculate([%scrap], KEEPFILTERS(index(1, All(SAPWorkCenter[CDL]), orderby([%scrap],desc) ) ))

     

    top 2nd=

    calculate([%scrap], KEEPFILTERS(index(2, All(SAPWorkCenter[CDL]), orderby([%scrap],desc) ) ))

     

    Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U

    • andreazambon's avatar
      andreazambon
      Icon for Helper V rankHelper V

      Ok, so you are calculating the Scrap index for the first line, it's a different strategy but it could work.

      Just to know, the Scrap that I use to rank the lines is a YTD calculation, so I modified your formula this way:

       

      %Scrap_1st_CDL = calculate([Scrap_Index_kg], KEEPFILTERS(index(1, All(SAPWorkCenter[CDL]), orderby([YTD_%scrapDesc_kg],desc) ) ))

       in order to show the %scrap not YTD in the right month. 

      I only need to know: with this strategy I need a measure for the value and a measure for the line. Is my consideration correct? Thanks

        "%scrap" is a YTD calculation. It seems that your formula shows the %scrap value