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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Vegas95
Regular Visitor

Dax

 Hi everyone,

 

My dataset is like this:

Account               Date              Value

A                          31/12/2022     $200

B                          31/12/2022      $300

C                          31/12/2022      $100

A                          31/12/2021     $700

B                          31/12/2021      $400

C                          31/12/2021      $200

 

I need to sum, for example, only the values A and C for the 2022. What's the best way or DAX expression to do this?

 

Thanks you for helping me!!

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

Hi, @Vegas95 ;

I've made a little modification here.

Sum of A + C = CALCULATE(SUM([Value]),FILTER('Table', YEAR([Date])=2022 && ([Account] ="A" || [Account] ="C")))

Or 

Sum of A + C = CALCULATE(SUM([Value]),FILTER('Table', YEAR([Date])=2022 && ([Account] in {"A" ,"C"})))

The final show:

vyalanwumsft_0-1666851777155.png


Best Regards,
Community Support Team _ Yalan Wu
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-yalanwu-msft
Community Support
Community Support

Hi, @Vegas95 ;

I've made a little modification here.

Sum of A + C = CALCULATE(SUM([Value]),FILTER('Table', YEAR([Date])=2022 && ([Account] ="A" || [Account] ="C")))

Or 

Sum of A + C = CALCULATE(SUM([Value]),FILTER('Table', YEAR([Date])=2022 && ([Account] in {"A" ,"C"})))

The final show:

vyalanwumsft_0-1666851777155.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Analystmate
Helper II
Helper II

@Vegas95  Try this dax to create a measure : 

Sum of A + C = CALCULATE(SUM([Value]),YEAR([Date])=2022 && [Account] ="A" || [Account] ="C")

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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