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
MasTristan
Frequent Visitor

Put a running total clustered with a sum by month

Hello, I have a clustered bar chart on which I grouped the sum of my sales by month. I am using the Date Hierarchy of my date column. I would like to add a bar per month that represents a current total: the sum of that month and previous months, which resets to 0 each December. I have found several pieces of code in the forum but each time it is necessary to remove the DateHierarchy and I therefore end up with a bar per sale, and not a group by month.

How can I do this?

 

At the moment I have this : 

MasTristan_0-1671790724575.png

 

and I would like something like this : 

MasTristan_2-1671790935636.png

 

I hope you'll see the idea

 

I can't calculate a new column direcly because these are the sales filtered by saler and this filter is applicated on the dashboard

Thank you

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @MasTristan ,

I created some data:

vyangliumsft_0-1672039627663.png

Here are the steps you can follow:

1. Enter data – create table.

vyangliumsft_1-1672039627664.png

2. Create measure.

Value1 =
SUMX(FILTER(ALL('Table'),
'Table'[Year]=MAX('Table'[Year]) && 'Table'[Month]=MAX('Table'[Month])),[Value])
Value2 =
SUMX(FILTER(ALL('Table'),
'Table'[Year]=MAX('Table'[Year]) && 'Table'[Month]<=MAX('Table'[Month])),[Value])
Group_Value =
IF(
    MAX('Table2'[Group]) ="that month",[Value1],[Value2])

3. Result:

vyangliumsft_2-1672039627669.png

 

Best Regards,

Liu Yang

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

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @MasTristan ,

I created some data:

vyangliumsft_0-1672039627663.png

Here are the steps you can follow:

1. Enter data – create table.

vyangliumsft_1-1672039627664.png

2. Create measure.

Value1 =
SUMX(FILTER(ALL('Table'),
'Table'[Year]=MAX('Table'[Year]) && 'Table'[Month]=MAX('Table'[Month])),[Value])
Value2 =
SUMX(FILTER(ALL('Table'),
'Table'[Year]=MAX('Table'[Year]) && 'Table'[Month]<=MAX('Table'[Month])),[Value])
Group_Value =
IF(
    MAX('Table2'[Group]) ="that month",[Value1],[Value2])

3. Result:

vyangliumsft_2-1672039627669.png

 

Best Regards,

Liu Yang

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

The only problem here is that it doesn't seems like the result is filtered by employee but for the rest it is ok so thanks

bolfri
Super User
Super User

Did you try YTD function to achive that?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.