Forum Discussion
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:
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!
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.
4 Replies
- ERDCommunity Champion
Hello Vegas95 ,
I would start with unpivoting columns: https://support.microsoft.com/en-us/office/unpivot-columns-power-query-0f7bad4b-9ea1-49c1-9d95-f588221c7098.
- ToddChittSuper 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.
- ToddChittSuper 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.
- Vegas95Regular Visitor
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?