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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Show total sum for the year for every bar in the chart in cluster column chart

Hi,

 

I need to create a measure where I am showing total sum for the year for every bar in the chart.

 

As can be seen from the below image is a dummy data.

amitdarak_0-1654173632845.png

This is what my output is when no month filter is selected. Basically 550 is sum for 2021, 309 is sum for 2022 and is showing for every month which is correct. 

 

amitdarak_1-1654176701303.png

But when I select month filter, in this case April, May it should not show 550, instead it should show 89 for 2021 and 146 for 2022.

 

amitdarak_2-1654177172327.png

Below is the DAX I have written. Any suggestion how to modify dax.

total_sum = CALCULATE(SUM(Sheet1[sales]),
ALLEXCEPT(Sheet1,
Sheet1[year],
Sheet1[bg]),
Sheet1[status] = "Settled")
1 ACCEPTED SOLUTION
SolomonovAnton
Super User
Super User

i think it will help you 

measure = CALCULATE(SUM(Sheet1[sales]),ALLSELECTED(Sheet1[month]))

View solution in original post

6 REPLIES 6
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

It depends on whether the year and month fields you use in the matrix come from the same table.


For example, if the year in the matrix comes from Table and the month comes from the Dates table, then you need to use that measure.

 

total_sum = 
CALCULATE (
    SUM ( 'Table'[Sales] ),
    ALLSELECTED ( 'Dates' ),
    'Table'[status] = "Settled"
)

 

If both month and year come from the Dates table, then use the measure.

 

total_sum 2 = 
CALCULATE (
    SUM ( 'Table'[Sales] ),
    FILTER ( ALLSELECTED ( 'Dates' ), Dates[Year] = MAX ( Dates[Year] ) ),
    'Table'[status] = "Settled"
)

vkkfmsft_0-1654658002645.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

SolomonovAnton
Super User
Super User

i think it will help you 

measure = CALCULATE(SUM(Sheet1[sales]),ALLSELECTED(Sheet1[month]))

Anonymous
Not applicable

Hi,

 

Came to know from some other post that if your column is sorted by another column you need to have both of them in the all statement. That worked for me. 

count = CALCULATE(
COUNT('Data'[Claim No]),
ALLSELECTED('Data'[month],'Data'[month_number]),
'Data'[Final Claim Status] in {"Settled", "Outstanding"})
 
Here I had sorted month by another column month_number and hence included that in Allselected statement and it worked.
 
Regards,
Amit Darak

 

Anonymous
Not applicable

Hi,

 

Strangely the same dax when I executed in my original report, it did not work. Please find below image. It shows monthly value for each month's bar and not sum of total month's selected.

 

amitdarak_0-1654254897685.png

 

Where as when I use the below formula, it gives me correct total for year, but does not change when I select month filter.

 

monthly_count = CALCULATE(COUNT(data[claim_no]),
ALLEXCEPT(data,
data[year],
data[claim_type],
'data'[bg]),
data[status] in {"Settled", "Outstanding"})

 

Any idea what am I missing here?

 

Thank You.

Regards,

Amit

 

amitchandak
Super User
Super User

@Anonymous , try one or the two

 

total_sum = CALCULATE(SUM(Sheet1[sales]),
filter(Sheet1,
Sheet1[status] = "Settled"))

 

or

 

total_sum = CALCULATE(SUM(Sheet1[sales]),
ALLEXCEPT(Sheet1,
Sheet1[year],Sheet1[month],
Sheet1[bg]),
Sheet1[status] = "Settled")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi,

 

Unfortunately this does not give the expected result.

 

Regards,

Amit

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors