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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Kieron73737
New Member

Calculated Column that is the sum of two columns if selected in a slicer

I have a set of data, it is a list of names of people and how many trophies they won in 2021, 2022, and 2023. I want to create a calculated Column that is the total trophies they have ever won however my problem is that I want the dashboard user to be able to select if it's 2021 and 2023 or just 2022 or 2022 and 2023. My idea to do this was to use a slicer which has values 2021,2022,2023 etc and then conditionally sum those respective record values if selected. 

 

I have tried creating a variable for slicers which does identify what is selected but am unable to use this to select columns. 

 

I used years = var ___slicer = SELECTEDVALUE('YearSelector'[Trophies]) which when displayed on a table drops the years not selected. How can I link this to the columns to sum

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Kieron73737 

 

You can try the following methods.
Sample data:

vzhangti_0-1685412480749.png

Measure:

Sum = CALCULATE(SUM('Table'[Value]),ALLEXCEPT('Table','Table'[Year]))

vzhangti_1-1685412524914.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Kieron73737 

 

You can try the following methods.
Sample data:

vzhangti_0-1685412480749.png

Measure:

Sum = CALCULATE(SUM('Table'[Value]),ALLEXCEPT('Table','Table'[Year]))

vzhangti_1-1685412524914.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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