Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tcurtis
Helper I
Helper I

Cumulative Stakced column chart

I am trying to make a cumulative stacked column chart using different measures. The chart will be a month over month and year to date. I use a date slicer to choose the date range that I am looking for. This way I can choose dates in 2019 and see 2019, or choose 2018 and see 2018. How do I make the below measure display a cumulative sum month over month?

 

YTD_RCA_SAV_CORP = CALCULATE(SUM(tbl_RCA_Cost_Savings[Total_Savings]),
DATESYTD('Date Table'[Date]),
FILTER(tbl_RCA_Cost_Savings,tbl_RCA_Cost_Savings[Plant]IN {"1200", "1230", "1250"}))
1 ACCEPTED SOLUTION

Hi, @Tcurtis 

According to your description, the problem seems to exist in the relationship between your ‘Date’ table and the main table.

I also went back to my test pbix file, and also created a Calendar table like this:

Calendar = CALENDARAUTO( )

Then I create a Many to one and Both filter relationship between the two tables, like this:

v-robertq-msft_0-1614326019220.png

 

Then I changed the Date columns in the charts and Slicers with the date columns in the Calendar table, my chart can also work normally like before:

v-robertq-msft_1-1614326019254.png

 

v-robertq-msft_2-1614326019261.png

 

You can download my test pbix file here

You can also go to check your relationship between tables and find if there is a problem.

 

Best Regards,

Community Support Team _Robert Qin

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

View solution in original post

4 REPLIES 4
v-robertq-msft
Community Support
Community Support

Hi, @Tcurtis 

According to your description, you want to make a measure to display a cumulative sum month over month in a stacked column chart, I’ve created some test data to achieve this, you can try my measure:

This is part of my test data based on your requirement:

v-robertq-msft_0-1614245271404.png

cumulative sum month over month =

CALCULATE(

    SUM(Sheet1[Amount]),

    FILTER(

        ALLSELECTED(Sheet1),

        MONTH([Date])<=MONTH(MAX([Date]))&&

        YEAR([Date])=YEAR(MAX([Date])

)))

Then I created a stacked column chart and placed like this, and two Slicers to slice the data based on Year and Month, like this:

v-robertq-msft_1-1614245271483.png

 

And you can get what you want, like this(If you want to see the data in 2018):

v-robertq-msft_2-1614245271487.png

 

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

Thanks for your help. You solution works if I do not use my date table and use the date column in the table itself. I created a date table and created a relationship to all my tables and then created measures. But my date slicer will not effect the measures in my visuals.

The two measure examples below seem to be a good example of my issues. The first one uses a date hiearchy from my Date Table and the secone one does not. The first measure will NOT give my visual month over month but the second one will. I have no idea why the hiearchy would effect the measures like this. Also, neither of these will work with my date slicer I have using my Date Table. I wish I could share this with you but it is sensitive data and I cannot publish it.

I could set up each page with it's own Year filter but I would rather choose the year on my main page and let it control all of my other pages. I have checked to make sure my slicers are synced also. I have built other pbix visuals but this is the first time I have had this many issues with measures and date slicers.

CONT_SAV_CORP = CALCULATE([CONTRACT_CON_CORP]-[Vendor_CONTRACT_CORP], DATESYTD('Date Table'[Date])) - Date Hiearchy

CONT_SAV_CORP = CALCULATE([CONTRACT_CON_CORP]-[Vendor_CONTRACT_CORP], DATESYTD('Date Table'[DateUsed])) - Non Hiearchy

Hi, @Tcurtis 

According to your description, the problem seems to exist in the relationship between your ‘Date’ table and the main table.

I also went back to my test pbix file, and also created a Calendar table like this:

Calendar = CALENDARAUTO( )

Then I create a Many to one and Both filter relationship between the two tables, like this:

v-robertq-msft_0-1614326019220.png

 

Then I changed the Date columns in the charts and Slicers with the date columns in the Calendar table, my chart can also work normally like before:

v-robertq-msft_1-1614326019254.png

 

v-robertq-msft_2-1614326019261.png

 

You can download my test pbix file here

You can also go to check your relationship between tables and find if there is a problem.

 

Best Regards,

Community Support Team _Robert Qin

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

parry2k
Super User
Super User

@Tcurtis what is not working? Can you show sample data and screenshots, what is not working as expected or where you are getting the unexpected result?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.