Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Cumulative stacked bar chart

Hi There,

 

I have two columns in my data table. The first indicates the year of the entry from 1990 onwards, the second indicates the group of the entry "A", "B", "C" or "D". I'd like to present a cumulative stacked bar chart, which indicates the cumulative total of "A"s, "B"s, "C"s and "D"s in each year, e.g. the stacked bar for 1990 reports the numbers of each group for 1990 only, the 1991 stacked bar reports the numbers of each group for 1990 AND 1991 etc.

 

I can't quite get my new measure to work.

 

Any help would be appreciated.

 

Thanks,

 

Rob.

  • Hi Anonymous ,

     

    You could try the dax below:

    Cumulative = CALCULATE(COUNT(TEST[items]),FILTER(ALLEXCEPT(TEST,TEST[items]),SELECTEDVALUE(TEST[year])>=TEST[year]))
     

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Cumulative should work like

    Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))
    
    Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all(Table),table[Year]<=max(table[Year])))

     

    As you are going to take entity as a legend, this one should work.

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi Anonymous ,

     

    You could try the dax below:

    Cumulative = CALCULATE(COUNT(TEST[items]),FILTER(ALLEXCEPT(TEST,TEST[items]),SELECTEDVALUE(TEST[year])>=TEST[year]))
     

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.