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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Username1848
Regular Visitor

Show sum of only selected values

Hello all,

 

I have a table with sales from different years (and different customers, but this isn't too important for my question).

 

I want to create a measure that calculates the sum of the values (from "Value") of only the selected years in the "Category" column. I pasted an exemplary table below. I want to e.g. filter "Category" for the years 2024, 2025, and 2026 and get the result of the values of 81.000.

 

I tried with this measure, but it won't display the visual:

 

Sales 23 (€) Selected Category = CALCULATE(SUM('sales planning 2023'[Value]),FILTER('sales planning 2023',SELECTEDVALUE('sales planning 2023'[Category])))

 

CustomerCategoryValue
ASales 2023          10.000
BSales 2023             9.000
CSales 2023          12.000
ASales 2024          12.000
BSales 2024          11.000
CSales 2024          14.000
BSales 2025          11.000
CSales 2025            5.000
ASales 2026          14.000
CSales 2026          14.000
CSales 2027             9.000
ASales 2028          12.000
BSales 2028          12.000
CSales 2028          10.000
CSales 2029          11.000
BSales 2030             9.000
CSales 2030          12.000
ASales 2031          10.000

 

Any help is highly appreciated! Best regards

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Username1848 
If I understand you, you want to calculate an amount based on the context of a filter.
It's just a simple sum formula.
See attached image and file for an example
If not, please provide an example of what you are attempting to accomplish

Ritaf1983_0-1683864120976.png

Link to sample file 

 

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
Ritaf1983
Super User
Super User

Hi @Username1848 
If I understand you, you want to calculate an amount based on the context of a filter.
It's just a simple sum formula.
See attached image and file for an example
If not, please provide an example of what you are attempting to accomplish

Ritaf1983_0-1683864120976.png

Link to sample file 

 

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



Hi @Ritaf1983, thanks for your reply! I only now realize that I didn't describe my actual problem. I want to close this threat and open another where I describe my problem in more detail.

 

For the above described question, your answer is correct, thanks.

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.