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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Vegas95
Regular Visitor

help me please

Hi everyone,

 

I want to calculate some balance sheet indicators. I'm using only one file that contains on the first column the name of the account and in the other columns (for each account) the values from 2017 to 2007.  

My file is like this:

Vegas95_1-1666781557067.png

 

How can I sum more values referring, for example, to 2017? I am trying to create a new measure, but without success! 

Can you help me pleeease?

 

Thanks you!

1 ACCEPTED SOLUTION
ToddChitt
Super User
Super User

Create a new MEASURE with code like this;

My Measure = CALCULATE ( SUM ( 'Table'[Value] ), 'Table[Account] = "A", 'Table'[Date].Year = 2022 )

 

Note the purposeful exclusion of the logic for also getting Account = B in this measure. I am going to leave it up to you to research the CACLUCATE funtion, and the Logical Or operator.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
ToddChitt
Super User
Super User

Create a new MEASURE with code like this;

My Measure = CALCULATE ( SUM ( 'Table'[Value] ), 'Table[Account] = "A", 'Table'[Date].Year = 2022 )

 

Note the purposeful exclusion of the logic for also getting Account = B in this measure. I am going to leave it up to you to research the CACLUCATE funtion, and the Logical Or operator.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





ToddChitt
Super User
Super User

Try UNPIVOT of the data in Power Query. That will get you a dataset like this:

Account               Date              Value

A                          31/12/2022     $200

B                          31/12/2022      $300

 

Now, ALL dates are in the same column.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Thanks you!

 

Now, 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 B for the 2022. What's the best DAX expression to do this?

 

 

ERD
Community Champion
Community Champion

Hello @Vegas95 , 

I would start with unpivoting columns: https://support.microsoft.com/en-us/office/unpivot-columns-power-query-0f7bad4b-9ea1-49c1-9d95-f5882....

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.