Forum Discussion

JeremyJvR's avatar
JeremyJvR
New Member
4 years ago

Cumulative values and fill between values

Hi All,

 

I need some help with a measure to cumulate values, cut it off at the maximum "Index" value, but still keep fill the values between "Index" values that don't have values.

 

Basically my table look as follows.

I want the "Blue" lines to fill with the previous value and the "Red" lines to stay blank.

 

My current Measure looks like this.

 

IF(FIRSTNONBLANK(MasterValues[Index], MasterValues[Index]) <= max(Pricelist_table[Sort]),

CALCULATE(
    COUNTA('Pricelist_table'[Stock No]),
    FILTER(
        CALCULATETABLE(
            SUMMARIZE('MasterValues', 'MasterValues'[Index], 'MasterValues'[Category]),
            ALLSELECTED('MasterValues')
        ),
        ISONORAFTER(
            'MasterValues'[Index], MAX('MasterValues'[Index]), DESC
        
    )
)), BLANK())
 
Context - "Sort" = Lookupvalue of the "Index" column in MasterValues
 
Thanks in advanced
 

6 Replies

  • JeremyJvR , try like


    CALCULATE(
    COUNTA('Pricelist_table'[Stock No]), filter( allselected('MasterValues'),'MasterValues'[Index]<= MAX('MasterValues'[Index])))

     

    or

     

    IF(FIRSTNONBLANK(MasterValues[Index], MasterValues[Index]) <= max(Pricelist_table[Sort]),
    CALCULATE(
    COUNTA('Pricelist_table'[Stock No]),
    FILTER(
    CALCULATETABLE(
    SUMMARIZE(allselected('MasterValues'), 'MasterValues'[Index], 'MasterValues'[Category]),
    ALLSELECTED('MasterValues')
    ),
    ISONORAFTER(
    'MasterValues'[Index], MAX('MasterValues'[Index]), DESC

    )
    )), BLANK())

    • JeremyJvR's avatar
      JeremyJvR
      New Member

      Thanks for the reply.

       

      It almost works, but not yet.

       

      I need it to stop as soon as it hits the maximum, in this case 840.

       

      The issue is that I want to plot this on a line graph against different stock units. It just looks ugly on the graph when those gaps shows