Forum Discussion
Add rows together depending on another row/column value
Bagpuss
I think I can get a bit of your requirement but not very clear. You could take get the sum with:
Measure = SUM([actuals to period])
Then use slicer to select the value. See example:
If not clear, you might want to look at this post see how to post quesiton with sample.
Read this post to describe your sample:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Basically, provide an expect output and clearly describe the logic of the calculation. So we can give a exact dax formula.
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
- Bagpuss5 years agoRegular Visitor
Thanks Paul for your reply and sorry for the delay, currently juggling projects. That would do it but I don't want the end user to have to use a Slicer, I want to filter the ledger codes where they equal a certain code and then take the Actuals to period where they are filtered by Ledger Codes and add them together. The end result being all the Actuals to Period added together where a ledger codes all start with 2 for example? I then need to take this figure and use it in another measure.
- Bagpuss5 years agoRegular Visitor
Think I figured it out by adapting a quick measure, used the below code and it appears to be adding all my actual to period values where ledger codes equal the list I have at the end of the measure DAX code 🙂
Now what would be really cool if it could add all codes up together starting with 2 as I have a lot but am I asking too much?
Total Salary =CALCULATE(SUM('Ledgers'[Actuals to Period]),'Ledgers'[Ledger Code] IN {"2000-01","2001-01","2002-01" })